bug#9718: bugs in `date` command?

2011-10-16 Thread Voelker, Bernhard
Jim Meyering wrote:

> Eric Blake wrote:
> ...
> > As currently coded in the grammar, this is correct.  But if someone
> > were willing to put forth the effort to update parsedate.y, as well as
> > enhance the testsuite to cover things, it might be possible to improve
> > the grammar to accept both common meanings of "second" depending on
> > the context where it appears compared to the rest of the date.
> 
> Just in case, I've marked this as "wishlist".
> If you're interested, please add it to TODO.
> If not, please close this.

I don't know if it violates some standards, but I'd vote for
abbreviations like "1st", "2nd", "3rd", "4th", etc. which do not
interfere with the double meaning of "second".
What do you think?

Have a nice day,
Berny




bug#9718: bugs in `date` command?

2011-10-14 Thread Jim Meyering
severity 9718 wishlist
tags 9718 + notabug
thanks

Eric Blake wrote:
...
> As currently coded in the grammar, this is correct.  But if someone
> were willing to put forth the effort to update parsedate.y, as well as
> enhance the testsuite to cover things, it might be possible to improve
> the grammar to accept both common meanings of "second" depending on
> the context where it appears compared to the rest of the date.

Just in case, I've marked this as "wishlist".
If you're interested, please add it to TODO.
If not, please close this.





bug#9718: bugs in `date` command?

2011-10-11 Thread Eric Blake

On 10/11/2011 01:31 AM, Voelker, Bernhard wrote:

Bryan Lee wrote:


The term "third wednesday" seems to be evaluating incorrectly.

glaive 12:24:56 [~]% date
Mon Oct 10 12:24:59 EDT 2011

glaive 12:24:59 [~]% date -d "first wednesday"
Wed Oct 12 00:00:00 EDT 2011

glaive 12:25:09 [~]% date -d "second  wednesday"
Wed Oct 12 00:00:01 EDT 2011


Indeed, this was parsed as "first wednesday + 1 second"


Thank you for the report, however I don't see what's wrong.
I guess you meant "second wednesday" - which you probably expected
to display Oct 19th?

As 'second' is already used for the time unit 'second', it cannot
be used as an ordinal number for 2nd.


As currently coded in the grammar, this is correct.  But if someone were 
willing to put forth the effort to update parsedate.y, as well as 
enhance the testsuite to cover things, it might be possible to improve 
the grammar to accept both common meanings of "second" depending on the 
context where it appears compared to the rest of the date.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org





bug#9718: bugs in `date` command?

2011-10-11 Thread Voelker, Bernhard
Bryan Lee wrote:

> The term "third wednesday" seems to be evaluating incorrectly.
> 
> glaive 12:24:56 [~]% date
> Mon Oct 10 12:24:59 EDT 2011
> 
> glaive 12:24:59 [~]% date -d "first wednesday"
> Wed Oct 12 00:00:00 EDT 2011
> 
> glaive 12:25:09 [~]% date -d "second  wednesday"
> Wed Oct 12 00:00:01 EDT 2011
> 
> glaive 12:25:16 [~]% date -d "third  wednesday"
> Wed Oct 26 00:00:00 EDT 2011
> 
> glaive 12:25:21 [~]% date -d "fourth  wednesday"
> Wed Nov  2 00:00:00 EDT 2011

Thank you for the report, however I don't see what's wrong.
I guess you meant "second wednesday" - which you probably expected
to display Oct 19th?

As 'second' is already used for the time unit 'second', it cannot
be used as an ordinal number for 2nd. The info text clarifies this
(info coreutils 'date invocation'):

 A few ordinal numbers may be written out in words in some contexts.
  This is most useful for specifying day of the week items or relative
  items (see below).  Among the most commonly used ordinal numbers, the
  word `last' stands for -1, `this' stands for 0, and `first' and `next'
  both stand for 1.  Because the word `second' stands for the unit of
  time there is no way to write the ordinal number 2, but for convenience
  `third' stands for 3, `fourth' for 4, `fifth' for 5, `sixth' for 6,
  `seventh' for 7, `eighth' for 8, `ninth' for 9, `tenth' for 10,
  `eleventh' for 11 and `twelfth' for 12.

Did you mean this?

Have a nice day,
Berny




bug#9718: bugs in `date` command?

2011-10-10 Thread Bryan Lee
The term "third wednesday" seems to be evaluating incorrectly.


glaive 12:24:56 [~]% date
Mon Oct 10 12:24:59 EDT 2011

glaive 12:24:59 [~]% date -d "first wednesday"
Wed Oct 12 00:00:00 EDT 2011

glaive 12:25:09 [~]% date -d "second  wednesday"
Wed Oct 12 00:00:01 EDT 2011

glaive 12:25:16 [~]% date -d "third  wednesday"
Wed Oct 26 00:00:00 EDT 2011

glaive 12:25:21 [~]% date -d "fourth  wednesday"
Wed Nov  2 00:00:00 EDT 2011

glaive 12:25:27 [~]% date -d "fifth  wednesday"
Wed Nov  9 00:00:00 EST 2011

glaive 12:25:34 [~]% date -d "next  wednesday"
Wed Oct 12 00:00:00 EDT 2011

glaive 12:25:41 [~]% date -d "last  wednesday"
Wed Oct  5 00:00:00 EDT 2011

glaive 12:25:46 [~]% date -d "this  wednesday"
Wed Oct 12 00:00:00 EDT 2011

glaive 12:33:39 [~]% date -d "third  wednesday this month"
Wed Oct 26 00:00:00 EDT 2011

glaive 12:34:11 [~]% date -d "3  wednesday"
Wed Oct 26 00:00:00 EDT 2011

glaive 12:34:13 [~]% date -d "2  wednesday"
Wed Oct 19 00:00:00 EDT 2011

glaive 12:34:28 [~]% date -d "1  wednesday"
Wed Oct 12 00:00:00 EDT 2011

glaive 12:34:39 [~]% date -d "4  wednesday"
Wed Nov  2 00:00:00 EDT 2011