Skip to main content

Day 10 of 100DaysOfSpec, 2.4 Common Microsyntaxes, contd.

I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.

Currently reading in 2.4 Common microsyntaxes

2.4.5 Dates and times

Surprise, surprise, we're using the Gregorian (standard Western) calendar. The spec actually—accurately—notes that that decision stems from "cultural biases".

Libraries that parse dates have to be reviewed to make sure they conform to the spec, which is more specific than ISO8601 formats, for example.

2.4.5.1 Months

A valid "month" string holds no information about time zones. It does, however, include the year. I would have assumed the browser parsed year, month, and day separately.

The spec says that two ASCII digits are used to denote the month portion of the month string (four for the year), but confusingly wherever in the spec it mentions months it does not include leading zeroes.

2.4.5.2 Dates

A valid "date" string contains the "month" string (which itself includes year and month), and a date string. It also does not hold any time zone information.

What's unclear to me is the difference between a "date string" and a "date component".

2.4.5.3 Yearless dates

Here's where things get interesting (non-web-nerds whisper, "you sure?")! You can have a valid "yearless date" string that contains just the month portion of the month string, and the day string. So a month string itself fails without a year, but a month string, without a year portion, as part of a date string is ok?

When you don't specify a year, Leap Day is allowed.

Responses

My blog uses Webmentions. Responses from sites which likewise support Webmentions, such as Twitter or people’s personal sites, will show up here.

No Webmentions have been sent to this post yet.