Subject: date Parse of '13:00 + 2 hours' Broken.

From: Ralph Corderoy <[email-masked]>
Date: Wed, 08 May 2019 12:57:10 +0100

Hi,

Using date from coreutils 8.31-1 on Arch Linux.
This surprised me.

    $ TZ=UTC0 /bin/date -d '1pm + 2 hours'
    Wed  8 May 15:00:00 UTC 2019
    $ TZ=UTC0 /bin/date -d '13:00 + 2 hours'
    Wed  8 May 12:00:00 UTC 2019

The documentation doesn't suggest `1pm' and `13:00' are treated
differently.  `--debug' helps.

    $ TZ=UTC0 /bin/date --debug -d '1pm + 2 hours'
    date: parsed time part: 01:00:00pm
    date: parsed relative part: +2 hour(s)
    ...
    $ TZ=UTC0 /bin/date --debug -d '13:00 + 2 hours'
    date: parsed time part: 13:00:00 UTC+02
    date: parsed relative part: +1 hour(s)
    date: input timezone: parsed date/time string (+02)
    ...

It looks like parsing is broken in the second case.

The result I wanted can also be obtained my omitting the `+'.

    $ TZ=UTC0 /bin/date -d '1pm 2 hours'
    Wed  8 May 15:00:00 UTC 2019
    $ TZ=UTC0 /bin/date -d '13:00 2 hours'
    Wed  8 May 15:00:00 UTC 2019

-- 
Cheers, Ralph.