GNU bug report logs - #17374
issue with '/bin/date' resolving months via '-d DATESTR'

Previous Next

Package: coreutils;

Reported by: Benjamin Richardson <benjamin.g.richardson <at> gmail.com>

Date: Tue, 29 Apr 2014 20:25:01 UTC

Severity: normal

Tags: 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

From: Benjamin Richardson <benjamin.g.richardson <at> gmail.com>
To: 17374 <at> debbugs.gnu.org
Subject: bug#17374: issue with '/bin/date' resolving months via '-d DATESTR'
Date: Tue, 29 Apr 2014 16:17:48 -0400
[Message part 1 (text/plain, inline)]
Hello,

I think my issue can best be described by demonstration. Here goes:

user <at> server$ /bin/date
Tue Apr 29 15:51:11 EDT 2014
user <at> server$ /bin/date -d 'last month' +%B
March
user <at> server$ /bin/date -d '*2 months ago*' +%B
*March*
user <at> server$ /bin/date -d '3 months ago' +%B
January

I expected 2 months ago to be February, not March. I get that Feb 29
doesn't exist, so returning a date that never happened might not make
sense. But in simply asking for the month, not the full date of 2 months
ago, could %B be calculated first, before rolling over to March 1st?

Here is some other potentially helpful info:

user <at> server$ rpm -qf /bin/date
coreutils-5.97-34.el5_8.1
user <at> server$ date -d '1 month ago'
Sat Mar 29 15:57:36 EDT 2014
user <at> server$ date -d '2 months ago'
Sat Mar  1 14:57:45 EST 2014
user <at> server$ date -d '3 months ago'
Wed Jan 29 14:58:41 EST 2014

Thanks!
Ben
[Message part 2 (text/html, inline)]

This bug report was last modified 11 years and 19 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.