W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

Confirmation welcome, --31, --30, --29 and -02-29 oddities...

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Sun, 28 Oct 2001 17:33:36 +0100
Message-ID: <3BDC3360.9060900@dyomedea.com>
To: xmlschema-dev@w3.org
Knowing that:

"3.2.13 gDay

[Definition:]   gDay is a gregorian day that recurs, specifically a day
of the month such as the 5th of the month. Arbitrary recurring days are
not supported by this datatype. The ·value space· of gDay is the space
of a set of calendar dates as defined in § 3 of [ISO 8601].
Specifically, it is a set of one-day long, monthly periodic instances."

I assume that the algorithm defined in "E Adding durations to dateTimes" 
is used to iterate over the different dates, including the rule about 
"pinning":

"Essentially, this calculation is equivalent to separating D into 
<year,month> and <day,hour,minute,second> fields. The <year,month> is 
added to S. If the day is out of range, it is pinned to be within range. 
Thus April 31 turns into April 30. Then the <day,hour,minute,second> is 
added. This latter addition can cause the year and month to change."

In other words, "--31" would iterate over Jan 31st, Feb 28th (or 29th 
depending on the year), Mar 31th, Apr 30th, ...

While this seems logical, I think that this should be better described 
in the recommendation. The side effect is that if you look at the number 
of days between two iterations for "--28", --29, 30 and "--31" you have 
(for a non leap year):

       Jan Feb Mar Apr May Jun
--28    31  28  31  30  31
--29    30  29  31  30  31
--30    29  30  31  30  31
--31    28  31  30  31  30

IMO, this is not fully conform with the sentence "Specifically, it is a 
set of one-day long, monthly periodic instances" since adding a month to 
CCYY-02-28 should give CCYY-03-28 and that with my interpretation, the 
result is kind of context dependent.

The same effect happens for "-02-29"...

Thanks

Eric

-- 
Rendez-vous ą Paris pour le Forum XML.
                     http://www.technoforum.fr/Pages/forumXML01/index.html
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Sunday, 28 October 2001 12:48:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:24 GMT