NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 846 - False Error ISO 8601 dates with reduced precision
False Error ISO 8601 dates with reduced precision
Status: RESOLVED FIXED
Product: Validator.nu
Classification: Unclassified
Component: HTML parser
HEAD
All All
: P2 normal
Assigned To: Nobody
http://home.markandlisa.net/date.html
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-27 08:08 CEST by madams74
Modified: 2011-08-01 06:59 CEST (History)
2 users (show)

See Also:


Attachments
File from above URL in case the link is down (since it's on my desktop pc) (316 bytes, text/html)
2011-06-27 08:08 CEST, madams74
Details

Note You need to log in before you can comment on or make changes to this bug.
Description madams74 2011-06-27 08:08:13 CEST
Created attachment 193 [details]
File from above URL in case the link is down (since it's on my desktop pc)

According to my understanding about ISO 8601, dates of reduced precision are valid.

Sources from which I got my information:
http://en.wikipedia.org/wiki/ISO_8601#Calendar_dates - second paragraph
http://www.w3.org/TR/NOTE-datetime - Formats section
http://www.cl.cam.ac.uk/~mgk25/iso-time.html - on 2nd page(?) - Reads: "If only the month or even only the year is of interest: 1995-02 or 1995"

Example dates that are not validating that should:
<time datetime="1997-06">06-1997</time>
<time datetime="1993">1993</time>

Errors produced from above:
Error: Bad value 1997-06 for attribute datetime on element time: The literal did not satisfy the date or time format.
From line 8, column 1; to line 8, column 25
d>?<body>?<time datetime="1997-06">06-199
Syntax of date or time:
(This format deviates from the spec draft.) An ISO 8601 date (i.e. YYYY-MM-DD.), time (i.e. hh:mm optionally followed by :ss optionally followed by . and digits) optionally with a time zone designator (i.e. either Z, +hh:mm or -hh:mm) or both date and time separated by T. Examples: 1996-01-01T12:05:25, 1996-01-01, 12:05:25, 1996-01-01T12:05:25.6-02:00
Error: Bad value 1993 for attribute datetime on element time: The literal did not satisfy the date or time format.
From line 9, column 1; to line 9, column 22
97</time>?<time datetime="1993">1993</
Syntax of date or time:
(This format deviates from the spec draft.) An ISO 8601 date (i.e. YYYY-MM-DD.), time (i.e. hh:mm optionally followed by :ss optionally followed by . and digits) optionally with a time zone designator (i.e. either Z, +hh:mm or -hh:mm) or both date and time separated by T. Examples: 1996-01-01T12:05:25, 1996-01-01, 12:05:25, 1996-01-01T12:05:25.6-02:00
Comment 1 Philip Jägenstedt 2011-07-31 00:13:00 CEST
Note that the spec no longer defines validity of dates in terms of ISO 8601.
Comment 2 madams74 2011-08-01 00:43:09 CEST
(In reply to comment #1)
> Note that the spec no longer defines validity of dates in terms of ISO 8601.

Thanks Philip.  You are correct.  I'm not sure how I missed this.  It seems unfortunate that dates can't be less precise like ISO 8601 defines.  But the draft maintainers seem to have decided this.

Perhaps the error message "An ISO 8601 date" should be changed to reflect the draft better.
Comment 3 Michael[tm] Smith 2011-08-01 06:59:08 CEST
(In reply to comment #2)
> Perhaps the error message "An ISO 8601 date" should be changed to reflect the
> draft better.

Note that the validator pulls in that part of the error message from the description here:

http://wiki.whatwg.org/wiki/MicrosyntaxDescriptions#date-or-time

I went ahead and edited that description to make it more accurate. The change will not show up in validator.nu until the next time it is redeployed, but for now you can see the results here:

http://www.w3.org/html/check?doc=http%3A%2F%2Fhome.markandlisa.net%2Fdate.html

That now reads:

[[
A valid date or time string; that is, one of the following: • a date, which must be in the form YYYY-MM-DD • or, a time, which must begin in the form hh:mm, and can optionally be followed by :ss, which in turn can optionally followed by “.” and one or more digits, and no time-zone information • or, a date followed by “T” followed by a time followed by time-zone information, which must be either “Z”, or in the form +hh:mm or the form -hh:mm • Examples: 1996-01-01, 12:05:25, 1996-01-01T12:05:25-02:00, 1996-01-01T12:05:25.6 • The validator behavior currently allows some values that the HTML specification prohibits; for example, it allows 1996-01-01T12:05:25 (a date and time with no time-zone information) and 12:05:25Z (a time with no date but with time-zone information).
]]

So I am closing this bug for now. But feel free to reopen it if you think further changes are needed.