On Sun, 2008-05-18 at 19:19 +0200, Aleksander Morgado wrote: > > > > The problem is that the result cannot be February 31st. So which > > would be the resulting epoch? > > > > Using the precedence rule first we add 1 year to 2007-01-31 resulting > > in 2008-01-31. Then we add 1 month (February in a leap year) resulting > > in 2008-02-29. > > > > What do you think? > > > > Well... don't really like it. This means that there are three different > time origins for which the calendar time span gives the same result... > isn't it? > > 29 January 2007 + (1 year + 1 month) = 29 February 2008 > 30 January 2007 + (1 year + 1 month) = 29 February 2008 > 31 January 2007 + (1 year + 1 month) = 29 February 2008
Have you considered doing a survey of other Date/Time/Calendar implementations to find out how they solve this problem? For example, a lot of careful thought and research has gone into the Perl DateTime modules. http://search.cpan.org/dist/DateTime/lib/DateTime.pm#Adding_a_Duration_to_a_Datetime
