Ok. So ISO8601:2000 defines all sorts of things, some of which are
impossible to distinguish from one another without outside
information:
+yYYYYMMDD Extended complete year
+yYYYYDDD Extended ordinal day in year
-YYMM Year and month in implied century
-DDD Ordinal day in implied year
-YY Year in implied century
+yYYYY Extended year
+yYY Excended century
Notation:
-: - Character
Y,M,D: Year, month, day digit respectively
+: + or - characters
The root of the collisions is the arbitrary number of extended digits
(which may be 0, so you could have -0101, now is that the year 102
BC, or January in 2001? The extended formats also collide internally,
i.e. what is the date +1985? Is it a century or a year?
The choices for resolving this are to:
1) Never allow an extended representation (even for +s which can't
collide externally) unless the user tells us to use it and
specifies the digits
2) Use the ordering above to break ties
I am leaning towards choice 2 for this, but things are not completely
dire since I plan to allow the user of the module to pick which
categories of formats to allow (and to specify how many digits are in
an extended date).
There are also collisions with time strings, but those are resolvable
with the following rules (stopping with the first rule that fits):
- It is what the user says it is
- If there is a T prefix
- If there is a TZ (Z or offset)
- If there are : separators
- Otherwise assume it is a date
-ben