GNU bug report logs -
#12772
date : Bug in handling human readable dates
Previous Next
Reported by: ga <at> alexandersfeld.de
Date: Wed, 31 Oct 2012 15:59:01 UTC
Severity: normal
Tags: moreinfo, notabug
Done: Eric Blake <eblake <at> redhat.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Wed, 31 Oct 2012 13:51:31 -0600
with message-id <50918143.9000002 <at> redhat.com>
and subject line Re: bug#12772: date : Bug in handling human readable dates
has caused the debbugs.gnu.org bug report #12772,
regarding date : Bug in handling human readable dates
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
12772: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12772
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hello,
today i discovered a bug in the programm "date" handling human readable timeformats.
The bug:
# date --version
date (GNU coreutils) 8.5
# export LC_ALL="C" ;date
Wed Oct 31 10:57:06 CET 2012
# export LC_ALL="C" ;date -d"last month"
Mon Oct 1 11:57:23 CEST 2012
# export LC_ALL="C" ;date -d"next month"
Sat Dec 1 10:57:35 CET 2012
While aktual monthh is still Oct, previous month is shown as Oct too, and next month is shown as Dec.
Correctly "last month" should be Sep. "next month" should be Nov.
regards,
Guido Ackermann
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
tag 12772 notabug
thanks
On 10/31/2012 04:00 AM, Guido Ackermann wrote:
> Hello,
> today i discovered a bug in the programm "date" handling human readable timeformats.
> The bug:
>
> # date --version
> date (GNU coreutils) 8.5
>
> # export LC_ALL="C" ;date
> Wed Oct 31 10:57:06 CET 2012
> # export LC_ALL="C" ;date -d"last month"
> Mon Oct 1 11:57:23 CEST 2012
> # export LC_ALL="C" ;date -d"next month"
> Sat Dec 1 10:57:35 CET 2012
>
> While aktual monthh is still Oct, previous month is shown as Oct too, and next month is shown as Dec.
> Correctly "last month" should be Sep. "next month" should be Nov.
Thanks for the report. However, this is the result of daylight savings
impacting the calculations. "last month" and "next month" translate to
a fixed number of 24-hour jumps, but since you are in a month with a
25-hour day, you still end up in October when going backwards, and skip
over the 30 days of November when going forwards.
This is a FAQ:
https://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
There, we give suggestions on how to avoid the ambiguities, such as by
starting at noon rather than midnight when jumping by days, or using the
15th instead of the first or last of a month when jumping by months, in
order to guarantee that the result lands in the desired granularity in
spite of the non-uniformity caused by daylight savings or changing
numbers of days per month. The FAQ also suggests using UTC instead of
local timezone to avoid daylight savings issues.
--
Eric Blake eblake <at> redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 12 years and 210 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.