Subject: Re: bug#6897: date -d '1991-04-14 +1 day' fails

From: Bob Proulx <[email-masked]>
Date: Tue, 24 Aug 2010 16:24:48 -0600

Paul Eggert wrote:
> Voelker, Bernhard wrote:
> > With a normal user's perspective, I'd expect `date` to "just do the job"
> 
> Gee, I don't know, all the normal users I know
> just want "date" to print the date.
> 
> Date arithmetic is pretty esoteric, after all.
> What is one month after 31 January, for example?
> There's no way this stuff can be done in a way
> that is straightforward and satisfies everybody.

Months (moonths?) are terrible.  An astronomical event that isn't
synchronized to anything human but forced to fit in irregular ways.
It isn't possible to have a regular answer that is consistent and
correct.

(I want to say that any calculation based upon months has no hope of
being correct.  It would be better to use 30 days or 4 weeks or other
such more precise figure.  But then we would degrade into a long
discussion about doing such things and looking at any appointment
calendar and the large number of "third Tuesday after the first Monday
in June" types of rules will show how hard it is to cover everything
needed.  Just try calculating the date of Easter for example.)

> I'm becoming more inclined to say that GNU date
> shouldn't be doing date arithmetic at all.

It does seem an odd thing to have in there.  One of the many feature
creeps that would probably have been nicer in a separate program.  It
would be great to have a general purpose calendar date and time
manipulation program.  For example, while it is nice to be able to
say "next Thursday" and have that work it would also be nice to ask
how many days (or how many weeks) exist between two dates and get an
answer directly.  In hindsight it seems better to use a separate
program for the calculation and then feed that answer to date for
setting the clock.

Bob