GNU bug report logs - #14613
Date -- incorrect invalid date

Previous Next

Package: coreutils;

Reported by: "Chris F.A. Johnson" <chris <at> cfajohnson.com>

Date: Thu, 13 Jun 2013 22:26:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 14613 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#14613; Package coreutils. (Thu, 13 Jun 2013 22:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Chris F.A. Johnson" <chris <at> cfajohnson.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 13 Jun 2013 22:26:03 GMT) Full text and rfc822 format available.

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

From: "Chris F.A. Johnson" <chris <at> cfajohnson.com>
To: bug-coreutils <at> gnu.org
Subject: Date  -- incorrect invalid date
Date: Thu, 13 Jun 2013 18:15:26 -0400 (EDT)
$ date -d '2 June, 2013'
date: invalid date `2 June, 2013'

  This should be accepted, just as 'June 2, 2013' is.

-- 
   Chris F.A. Johnson, <http://cfajohnson.com/>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)




Information forwarded to bug-coreutils <at> gnu.org:
bug#14613; Package coreutils. (Fri, 14 Jun 2013 20:29:02 GMT) Full text and rfc822 format available.

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

From: Bob Proulx <bob <at> proulx.com>
To: "Chris F.A. Johnson" <chris <at> cfajohnson.com>
Cc: 14613 <at> debbugs.gnu.org
Subject: Re: bug#14613: Date  -- incorrect invalid date
Date: Fri, 14 Jun 2013 14:28:56 -0600
severity 14613 wishlist
thanks

Chris F.A. Johnson wrote:
> $ date -d '2 June, 2013'
> date: invalid date `2 June, 2013'
> 
>   This should be accepted, just as 'June 2, 2013' is.

Patches to improve the old date parser would always be considered and
appreciated.  The date parser is an old legacy piece of code and has
many known limitations.

Bob




Severity set to 'wishlist' from 'normal' Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Fri, 14 Jun 2013 20:29:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#14613; Package coreutils. (Sat, 27 Jul 2013 07:02:02 GMT) Full text and rfc822 format available.

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

From: Sergio Durigan Junior <sergiodj <at> riseup.net>
To: 14613 <at> debbugs.gnu.org
Subject: [PATCH] Make parse_datetime (and therefore `date') handle 'DAY MONTH,
 YEAR'
Date: Sat, 27 Jul 2013 04:01:28 -0300
Hi there,

I have a fix for this issue.  This fix touches Gnulib, but I am sending
it here anyway so you guys can test and make sure it works.

It basically adds a simple production on lib/parse-datetime.y to extend
it in order to correctly handle the proposed date format, i.e., '2 June,
2013'.  It works OK here, but I'd be glad if you could give it a test.
Comments are also obviously welcome.

Thanks,

-- 
Sergio

diff --git a/ChangeLog b/ChangeLog
index 4d73a26..d9d89ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-07-27  Sergio Durigan Junior  <sergiodj <at> riseup.net>
+
+	* lib/parse-datetime.y (date): Add production to handle dates like
+	'27 July, 2013'.  Problem reported for coreutils by Chris F.A.
+	Johnson in <http://bugs.gnu.org/14613>.
+
 2013-07-09  Paul Eggert  <eggert <at> cs.ucla.edu>
 
 	regex: port to --with-included-regex --enable-gcc-warnings non-threaded
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 4dce7fa..675ba5c 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -535,6 +535,13 @@ date:
         pc->month = $2;
         pc->year = $3;
       }
+  | tUNUMBER tMONTH ',' tUNUMBER
+      {
+        /* e.g. 2 June, 2013.  */
+        pc->day = $1.value;
+	pc->month = $2;
+	pc->year = $4;
+      }
   | iso_8601_date
   ;
 




Information forwarded to bug-coreutils <at> gnu.org:
bug#14613; Package coreutils. (Sat, 27 Jul 2013 21:46:01 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Sergio Durigan Junior <sergiodj <at> riseup.net>
Cc: 14613 <at> debbugs.gnu.org
Subject: Re: bug#14613: [PATCH] Make parse_datetime (and therefore `date')
 handle 'DAY MONTH, YEAR'
Date: Sat, 27 Jul 2013 23:45:17 +0200
That format is typically considered to be erroneous, e.g.,
<http://www.grammar.com/dates-day-month-year/>, so I'm
not sure parse_datetime should be supporting it.




Information forwarded to bug-coreutils <at> gnu.org:
bug#14613; Package coreutils. (Sat, 27 Jul 2013 23:14:02 GMT) Full text and rfc822 format available.

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

From: Sergio Durigan Junior <sergiodj <at> riseup.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 14613 <at> debbugs.gnu.org
Subject: Re: bug#14613: [PATCH] Make parse_datetime (and therefore `date')
 handle 'DAY MONTH, YEAR'
Date: Sat, 27 Jul 2013 20:13:34 -0300
On Saturday, July 27 2013, Paul Eggert wrote:

> That format is typically considered to be erroneous, e.g.,
> <http://www.grammar.com/dates-day-month-year/>, so I'm
> not sure parse_datetime should be supporting it.

I wasn't aware parse_datetime followed a defined grammar.  And this
seems to be an English grammar idiosyncrasy, which is definitely not
familiar to me (not a native english speaker).

IMO, I don't really see a problem supporting an "erroneous English
grammar", since parse_datetime should probably not be so strict about it
and adapt to such small cases.

Anyway, just my opinion.

-- 
Sergio




This bug report was last modified 10 years and 275 days ago.

Previous Next


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