bug-coreutils
[Top][All Lists]
Advanced

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

RE: date bug


From: Aganan, Nicholas
Subject: RE: date bug
Date: Thu, 24 Apr 2008 08:21:28 -0500

Normally we use '+%<param>' to get the desired information. Why don't we
use '-%<param> to denote the 'last or previous' value or maybe use
'+%-<param>'

Example:
  %-b   locale's abbreviated previous month name (e.g., Jan)
  %-B   locale's full previous month name (e.g., January)
  %-C   previous century; like %Y, except omit last two digits (e.g.,
21)
  %-m   previous month (01..12)
  %-W   previous week number of year, with Monday as first day of week
(00..53)
  %-y   last two digits of the previous year (00..99)
  %-Y   previous year


Sorry, I'm not a programmer, I'm only a SysAd (your end user :). I want
to help but can't do anything.

-----Original Message-----
From: Eric Blake [mailto:address@hidden 
Sent: Thursday, April 24, 2008 8:52 AM
To: Aganan, Nicholas; bug-coreutils
Subject: Re: date bug

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

*****

The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential, proprietary, and/or privileged 
material. Any review, retransmission, dissemination or other use of, or taking 
of any action in reliance upon this information by persons or entities other 
than the intended recipient is prohibited. If you received this in error, 
please contact the sender and delete the material from all computers. GA622






reply via email to

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