GNU bug report logs - #35632
date Parse of '13:00 + 2 hours' Broken.

Previous Next

Package: coreutils;

Reported by: Ralph Corderoy <ralph <at> inputplus.co.uk>

Date: Wed, 8 May 2019 11:58:01 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ralph Corderoy <ralph <at> inputplus.co.uk>
To: 35632 <at> debbugs.gnu.org
Subject: bug#35632: date Parse of '13:00 + 2 hours' Broken.
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.




This bug report was last modified 5 years and 326 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.