[whatwg] Number of digits in seconds, date formats in general

Currently, the definition of Vaguer moments in time allows seconds  
that have only one digit before the decimal point and no digits after  
the decimal point. This doesn't make sense considering that hours and  
minutes must have two digits.

Concretely, I suggest that
conforming Specific moments in time match the following regular  
expression:
^[0-9]{4,}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(Z| 
([+-][0-9]{2}:[0-9]{2}))$
and conforming Vaguer moments in time *in attributes* match the  
following regular expression:
^(([0-9]{4,}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\.[0-9] 
+)?)?(Z|([+-][0-9]{2}:[0-9]{2}))?)?)|([0-9]{2}:[0-9]{2}(:[0-9]{2}(\. 
[0-9]+)?)?(Z|([+-][0-9]{2}:[0-9]{2}))?))$
(For "in content", insert \p{Zs}* in various places where the spec  
currently allows it and make T (T|\p{Zs}).)

Sorry about the length of the gibberish.

The first format is the HTML 4.01 format, except years over 9999 are  
allowed and fractional seconds are allowed. The second format allows  
a date, a datetime or a time and the with datetime and time the TZD  
and seconds are optional.

The motivation for these formats is consistency with HTML 4.01 and  
Web Forms 2.0 where departure from the formats required by those  
specs is not necessary. These formats allow leading zeros in the  
year. However, I think it would be reasonable to ban leading zeros in  
years that have 5 or more digits if WF 2.0 also bans those.

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/

Received on Monday, 20 November 2006 06:54:08 UTC