[Bug 1967] New: [F+O] Year Zero


           Summary: [F+O] Year Zero
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: ashok.malhotra@oracle.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org

XML Schema Part 2 contains this Note:

The date and time datatypes described in this recommendation were inspired by
[ISO 8601]. '0001' is the lexical representation of the year 1 of the Common Era
(1 CE, sometimes written "AD 1" or "1 AD"). There is no year 0, and '0000' is
not a valid lexical representation. '-0001' is the lexical representation of the
year 1 Before Common Era (1 BCE, sometimes written "1 BC").

Those using this (1.0) version of this Recommendation to represent negative
years should be aware that the interpretation of lexical representations
beginning with a '-' is likely to change in subsequent versions.

This is basically an acknowledgement that Schema got it wrong. Normal practice,
endorsed by ISO 8601, is that the proleptic gregorian calendar does include a
year zero, and that 0, -4, -8 etc are leap years (not -1, -5, -9 etc).

So what are we to do about it? Schema can consider changing the rules in a
subsequent version, because they're only concerned with validation, and they
could introduce some fairly simple version switch to preserve backwards
compatible behavior. In our specs, because we are concerned with date
computations, I think we need to get this right first time: changing the rules
in XPath 3.0 would be very disruptive.

A possible option is to say that (for this release) date/time operands and
results of arithmetic operations (dt - dt, dt + duration) must not be earlier
than 0001-01-01. We could also say explicitly that an implemetation is allowed
to support such arithmetic, but if it does so, it must assume the anticipated
change in the semantics of the data type, that is, the proleptic gregorian
calendar including year zero.

Michael Kay

Received on Saturday, 3 September 2005 07:33:30 UTC