HTML and CSS Reference
In-Depth Information
Of course, these are early days. The browser could call up the
native calendar application so you could browse dates to see
your prior appointments. The point is that the browser can now
understand what you mean. Previously, date pickers were—
from the perspective of the browser—nothing more than <div> s,
<span> s, and links with lots of JavaScript behaviour attached.
Now the browser knows that you're in fact entering an actual
time and date and can offer richer controls and integration with
other time/date information.
The time input type
<input type=time> allows input of a time in 24-hour format and
validates it. Once again, the actual user interface is left to the
browser; it could be as simple as entering numbers and throw-
ing an error if the user enters an hour greater than 24 or minute
greater than 59, or it could be far more elaborate: a clock face,
for example, with draggable hands. The user interface can also
allow for entry of a time zone offset.
The datetime input type
date and time validate a precise date and time. Local date and
time works as datetime except that the browser doesn't allow
the user to add (or change) a time zone offset.
The month input type
<input type=month> allows entry and validation of a month.
Although internally this is stored as a number between 1 and 12,
the browser may offer a selection method that uses the names
of the months instead. You could do this with a select box with
12 options, January to December, but this doesn't localise. Using
an HTML5 month input type, a French-localisiation of a browser
could offer a drop-down with “Janvier” instead of January, for
example. That's more work for the browser and less work for
you, and that's the way it should be.
 
Search WWH ::




Custom Search