bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: date bug


From: Eric Blake
Subject: Re: date bug
Date: Thu, 24 Apr 2008 06:51:49 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Please keep replies on the list, so that others may chime in.

According to Aganan, Nicholas on 4/24/2008 6:28 AM:
| You said "'last month' is documented to be equivalent to
| 'alter only the month field, then renormalize'" but your computation is
| based on the date. 'last month' should provide the name of the previous
| month with no dates.

You are looking at +%b in isolation.  But the code currently doesn't work
that way.  When -d is encountered, the code computes a complete date,
orthogonal to the date components that are later requested by the + format
string.  Therefore, "last month" on Mar 31 results in Feb 31, which must
be normalized, prior to even looking at what is to be output.

|
| If this month is Mar and you execute the 'last month' parameter the
| expected output should be Feb regardless what date it is.
|
| The best way to test this theory is by asking a person candidly "If this
| month is March, what was last month?" or "What is today's month? What
| was last month?".
|
| If users want to get the date, I think the right parameter is '<num>
| days ago' or '<num> weeks ago'.

Then please propose a patch to improve date's behavior.  I think it would
be reasonable to make the -d computation be a bit smarter about what
fields need to be normalized based on what fields will be output, but the
task is not trivial, and I am not volunteering for the work.

|
| I found the workaround solution by using '31 days ago' if it is the 31st
| day of the month.

And that is what the manual recommends, too, since it does not result in
an ambiguous date that needs normalization.

|
| I will certainly move to 6.11.
|
| Thanks and more power.
|

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgQgmQACgkQ84KuGfSFAYCjjQCdFz/mOKX1+i3kvbDrdqa4nMTU
e5kAn01/f1IHgDiBnb3ndtNYvsPXNuuR
=JXCP
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]