getdate: correctly interpret "next monday" when run on a Monday
authorGiuseppe Scrivano <gscrivano@gnu.org>
Fri, 1 May 2009 07:23:20 +0000 (09:23 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 3 May 2009 07:32:20 +0000 (09:32 +0200)
commit9b518aa03eb0ea04dac464d0bb4db6377d84cf79
tree5f44b73badc1c0c659b70f993968a162fe5aee44
parent181a69f91ee2e3699b5e4a5a21f1fc3c843568e5
getdate: correctly interpret "next monday" when run on a Monday

* lib/getdate.y (get_date): Correct the calculation of tm_mday so
that e.g., "next tues" (when run on a tuesday) results in a date
that is one week in the future, and not today's date.
I.e., add a week when the wday is the same as the current one.
Reported by Tom Broadhurst in http://savannah.gnu.org/bugs/?25406,
and earlier by Martin Bernreuther and Jan Minář.
* tests/test-getdate.c (main): Check that "next DAY" is always in
the future and that "last DAY" is always in the past.
ChangeLog
lib/getdate.y
tests/test-getdate.c