HTML and CSS Reference
In-Depth Information
There's a
date
type so there must to be a
time
type too. Again, this will still prompt the browser to display some
helper controls. Figure 6-10 shows the controls displayed in Opera.
Figure 6-10
An input element with the type time, as displayed in Opera.
Here is an example of a time input.
<input
type="time"
name="startTime" id="startTime">
At the time of writing this topic, only Opera and mobile Safari have full support for the new
date
and
time
types.
Google Chrome has partial support (only the
date
type), but other browsers will just display a standard text input.
Week and Month
As well as collecting a complete date, you can also specify that you would like just a week or month using the
week
and
month
types.
Using the
week
type will prompt the browser to display a picker that will help the user select a week in the year.
This value is then converted to a formatted string. For example:
2012-W29
.
The
month
type will also prompt the browser to display a date picker, this time just for selecting a month.
Figures 6-11 and 6-12 show
<input>
elements with the
week
and
month
types. Note how the browser highlights
only weeks/months for selection.