Hello, what do you think of the following patch? When the same day as the current one is provided then a week is added. It doesn't change the behaviour for days in the past.
It closes coreutils #25406. Giuseppe diff --git a/lib/getdate.y b/lib/getdate.y index 877b264..8154fd9 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -1435,7 +1435,7 @@ get_date (struct timespec *result, char const *p, struct timespec const *now) if (pc.days_seen && ! pc.dates_seen) { tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7 - + 7 * (pc.day_ordinal - (0 < pc.day_ordinal))); + + 7 * (pc.day_ordinal + (pc.day_ordinal > 0 && tm.tm_wday == pc.day_number) - (0 < pc.day_ordinal))); tm.tm_isdst = -1; Start = mktime (&tm); if (Start == (time_t) -1)