- From: Michael Kay <mhk@mhk.me.uk>
- Date: Tue, 30 Mar 2004 09:32:46 +0100
- To: "'Ashok Malhotra'" <ashokma@microsoft.com>, "'Henry Zongaro'" <zongaro@ca.ibm.com>, <public-qt-comments@w3.org>
> Henry: > I realized after I sent the note that we needed to be more > precise about > the wording and we should discuss the details. I'll put it on the > agenda. > > Here is my proposal: > You start with $arg2 and count towards $arg1. > Keeping the day and time values constant you increment the > month value, > rolling over the year value as needed until adding another month would > take you past $arg1. You then convert the months you added into an > yearMonthDuration. > > Make sense? > Your proposed text doesn't explain what happens with negative durations. I actually thought the wording in the Christmas Day draft was an improvement over the 12 Nov wording, and was probably OK. But here's a more precise approach: Firstly, calculate the number of months M1 between the supplied date/dateTime and the baseline xs:date -0001-01-01 (equivalent to the ISO 8601 date 0000-01-01). If the year is positive, this is (12*y + m-1) where y and m are the year and month components of the date. If the year is negative, M1 is the negative number (12*(y+1) + (12-m)). Now calculate the number of months M2 in the supplied duration, as 12*y+m where y and m are the year and month components of the duration. (If the duration is negative, both y and m are negative). Finally, add the number of months (M1+M2) to the baseline xs:date -0001-01-01, using the rules for adding a yearMonthDuration to a date. Michael Kay
Received on Tuesday, 30 March 2004 03:33:00 UTC