[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18328: can't say date -d '8pm -0500' though other combos work
From: |
Assaf Gordon |
Subject: |
bug#18328: can't say date -d '8pm -0500' though other combos work |
Date: |
Fri, 19 Oct 2018 22:25:00 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
tags 18328 confirmed
retitle 18328 date: '8pm -0500' is invalid (am/pm problem)
stop
(triaging old bugs)
Hello,
On 25/08/14 10:01 AM, 積丹尼 Dan Jacobson wrote:
$ date -d '8pm -0500'
date: invalid date ‘8pm -0500’ <--why can't this combo work?
This is indeed a bug (specifically in gnulib's date parsing module,
but easier to track here).
It seems the existence of the "am/pm" string causes the parser
to take a slightly different rule, then reject additional relative
values, unless they have a unit, e.g.:
$ date --debug -d '8pm +5 days'
date: parsed time part: 08:00:00pm
date: parsed relative part: +5 day(s)
[...]
Contrast it with a different (and confusing) rules when there is
no "am/pm", the relative number is always taken as the time zone, e.g.:
$ date --debug -d '8:00 +5 days'
date: parsed time part: 08:00:00 UTC+05
date: parsed relative part: +1 day(s)
date: input timezone: parsed date/time string (+05)
[...]
(from https://bugs.gnu.org/17161#31 )
I hope to get to this bug soon.
-assaf
- bug#18328: can't say date -d '8pm -0500' though other combos work,
Assaf Gordon <=