GNU bug report logs - #18328
date: '8pm -0500' is invalid (am/pm problem)

Previous Next

Package: coreutils;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Mon, 25 Aug 2014 16:02:01 UTC

Severity: normal

Tags: confirmed

Full log


Message #8 received at 18328 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
 18328 <at> debbugs.gnu.org
Subject: Re: bug#18328: can't say date -d '8pm -0500' though other combos work
Date: Fri, 19 Oct 2018 22:25:00 -0600
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




This bug report was last modified 6 years and 240 days ago.

Previous Next


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