#1143742 coreutils: date --date "1 day 1 hour ago" returns nonsense

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
Richard Lewis
Date:
2026-08-06 03:19:01 UTC
Severity:
normal
#1143742#5
Date:
2026-08-05 22:39:27 UTC
From:
To:
Dear Maintainer,

date --date "1 day 1 hour ago"

returns a date in the future. It works to do "1 day ago 1 hour ago".
suggest outputting an error if the string can't be parsed - or at
least documenting the syntax: the man-page suggests you can use natural language
but this seems incorrect.

#1143742#10
Date:
2026-08-06 03:16:09 UTC
From:
To:
Hi,

Richard Lewis said:

This is the behavior documented on the Texinfo manual [1]:

    The unit of time may be preceded by a multiplier, given as an
    optionally signed number. Unsigned numbers are taken as positively
    signed. No number at all implies 1 for a multiplier. Following a
    relative item by the string ‘ago’ is equivalent to preceding the
    unit by a multiplier with value -1.

The --debug option is also helpful for understanding how this works. See
the following lines:

    $ date --debug --date '1 day 1 hour ago' 2>&1 | grep 'adjustment'
    date: after date adjustment (+0 years, +0 months, +1 days),
    date: after time adjustment (-1 hours, +0 minutes, +0 seconds, +0 ns),

Thanks,
Collin

[1] https://www.gnu.org/software/coreutils/manual/html_node/Relative-items-in-date-strings.html