GNU bug report logs - #23664
Date Problem: Wrong return using last month today (2016-05-31)

Previous Next

Package: coreutils;

Reported by: "Felippe Silvestre" <silvestre <at> redeservice.com.br>

Date: Tue, 31 May 2016 18:29:01 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23664 in the body.
You can then email your comments to 23664 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#23664; Package coreutils. (Tue, 31 May 2016 18:29:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Felippe Silvestre" <silvestre <at> redeservice.com.br>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 31 May 2016 18:29:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Felippe Silvestre" <silvestre <at> redeservice.com.br>
To: <bug-coreutils <at> gnu.org>
Subject: Date Problem: Wrong return using last month today (2016-05-31)
Date: Tue, 31 May 2016 15:14:18 -0300
[Message part 1 (text/plain, inline)]
[root <at> superdssbox999 ~]# date

Tue May 31 15:10:47 BRT 2016

 

[root <at> superdssbox999 ~]# date -d"last month"

Sun May  1 15:10:52 BRT 2016

 

[root <at> superdssbox999 ~]# date -d"last day last month"

Sat Apr 30 15:10:54 BRT 2016

[root <at> superdssbox999 ~]#

 

Atte.

 

Felippe Silvestre

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

Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 31 May 2016 19:33:02 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Tue, 31 May 2016 19:33:02 GMT) Full text and rfc822 format available.

Notification sent to "Felippe Silvestre" <silvestre <at> redeservice.com.br>:
bug acknowledged by developer. (Tue, 31 May 2016 19:33:03 GMT) Full text and rfc822 format available.

Message #12 received at 23664-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Felippe Silvestre <silvestre <at> redeservice.com.br>,
 23664-done <at> debbugs.gnu.org
Subject: Re: bug#23664: Date Problem: Wrong return using last month today
 (2016-05-31)
Date: Tue, 31 May 2016 13:32:04 -0600
[Message part 1 (text/plain, inline)]
tag 23664 notabug
thanks

On 05/31/2016 12:14 PM, Felippe Silvestre wrote:
> [root <at> superdssbox999 ~]# date
> 
> Tue May 31 15:10:47 BRT 2016
> 
>  
> 
> [root <at> superdssbox999 ~]# date -d"last month"
> 
> Sun May  1 15:10:52 BRT 2016

You've hit a FAQ; relative date terms like "last month" are easier to
code if they merely add a fixed amount of 30 days, rather than a
variable logical amount, particularly since the amount that would be
variable may depend on things like daylight savings changes.

https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e

There is work underway to add a 'date --debug' option that will make it
more obvious HOW date is arriving at its results when presented with
inherently ambiguous requests, such as using "last month" near the
boundary of a month.

I'm closing out this particular request in the bug database, since it is
known behavior, but feel free to add more comments or even provide a
reason that it should be reopened if what has been mentioned above is
insufficient to help you with your use of 'date'.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 29 Jun 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 29 days ago.

Previous Next


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