W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2006

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

From: Henri Sivonen <hsivonen@iki.fi>
Date: Mon, 20 Nov 2006 16:54:08 +0200
Message-ID: <BC1B0E41-095C-4CC4-8B63-A6BB26F065AA@iki.fi>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:49 UTC