date: bug or design issue

[email protected]
Newsgroups gmane.comp.gnu.sh-utils.bugs
Message-ID <[email protected]>
Today, being "Sat Mar 30 13:45:38 PST 2002",
and date, being "date (GNU sh-utils) 2.0",
on "Linux spew 2.4.18 #2 Fri Mar 15 14:15:51 PST 2002 i686 unknown",
the following happens:

  % date --date 'last month'
  Sat Mar  2 13:47:14 PST 2002

when I would expect:

  % date --date 'last month'
  Thu Feb  28 13:47:14 PST 2002

This might be a design bug or an implementation bug as interpretation
of "last month" is ambiguous.
But either way, leaving it the way it is has very unintended consequences
in unambiguous circumstances:

  % date --date 'last month' +%Y-%m
  2002-03

Obviously, 2002-03 is "this month" :)

Don't know if this is related to the special month of February or
whether this probelm would happen on May 31st as well.

Thank you
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.