[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: date -d20060229 gives: "invalid date"
From: |
Paul Eggert |
Subject: |
Re: date -d20060229 gives: "invalid date" |
Date: |
Tue, 29 Aug 2006 11:19:06 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Steve Cousins <address@hidden> writes:
> Don't I love new "features" like this?! What is the purpose of this?
Don't you just love date string parsing? It's a subtle area, full of
surprises.
> How is it more useful to report an error rather than doing a
> meaningful conversion?
Because there's no such thing as a "meaningful conversion" that makes
everyone happy if you have an invalid date. Invalid dates are
inherently ambiguous. Is "Feb 29, 2006" actually Feb 28 or Mar 1? Is
02:30 on April 2, 2006 actually 03:30 or 01:30? You can come up with
good arguments either way. We warn users about the ambiguities by
saying "no, you must write something like '2004-02-29 +2 years' if you
want to add two years to a date". This avoids the ambiguity for "Feb
29, 2006".
> Is this a bug or a feature?
When it comes to parsing long digit strings, everything is a bug. (:-)
Use the hyphens; they are your friends.