(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
datetime-local | datetime-local | ||
===Type=== | ===Type=== | ||
− | + | input | |
===Synopsis=== | ===Synopsis=== | ||
How to render a date and time input field | How to render a date and time input field | ||
===Description=== | ===Description=== | ||
− | + | input elements of type datetime-local create input controls that let the user easily enter both a date and a time, including the year, month, and day as well as the time in hours and minutes. | |
The format of the date and time value used by this input type is YYYY-MM-DDThh:mm. | The format of the date and time value used by this input type is YYYY-MM-DDThh:mm. | ||
Line 15: | Line 15: | ||
===Example=== | ===Example=== | ||
<syntaxhighlight lang="html"> | <syntaxhighlight lang="html"> | ||
− | < | + | <label for="meeting-time">Choose a time for your appointment:</label> |
− | < | + | <input type="datetime-local" id="meeting-time" |
name="meeting-time" value="2022-03-01T10:00" | name="meeting-time" value="2022-03-01T10:00" | ||
min="2022-03-01T10:00" max="2022-03-01T18:00" /> | min="2022-03-01T10:00" max="2022-03-01T18:00" /> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | < | + | <label for="meeting-time">Choose a time for your appointment:</label> |
− | < | + | <input type="datetime-local" id="meeting-time" |
name="meeting-time" value="2022-03-01T10:00" | name="meeting-time" value="2022-03-01T10:00" | ||
min="2022-03-01T10:00" max="2022-03-01T18:00" /> | min="2022-03-01T10:00" max="2022-03-01T18:00" /> | ||
ws-class-props | |||
---|---|---|---|
Line 1: | Line 1: | ||
{{Doc properties | {{Doc properties | ||
− | |Subject version=2.0 | + | |Subject version=2.0,2.1 |
|Doc subject=DevOps:Doc/FlexForm | |Doc subject=DevOps:Doc/FlexForm | ||
|Doc parent=DevOps:Doc/FlexForm/1.0/input | |Doc parent=DevOps:Doc/FlexForm/1.0/input | ||
|Doc sort order=110 | |Doc sort order=110 | ||
|Doc target group=User | |Doc target group=User | ||
+ | |Doc synopsis=How to render a date and time input field | ||
}} | }} |
Latest revision as of 21:00, 31 March 2023
Name
datetime-local
Type
input
Synopsis
How to render a date and time input field
Description
input elements of type datetime-local create input controls that let the user easily enter both a date and a time, including the year, month, and day as well as the time in hours and minutes.
The format of the date and time value used by this input type is YYYY-MM-DDThh:mm.
Parameters
type="datetime-local"
All other valid parameters for an input field are valid. Additionally you can use min, max and step.
Example
<label for="meeting-time">Choose a time for your appointment:</label>
<input type="datetime-local" id="meeting-time"
name="meeting-time" value="2022-03-01T10:00"
min="2022-03-01T10:00" max="2022-03-01T18:00" />
Note
The displayed date and time formats differ from the actual value; the displayed date and time are formatted according to the user's locale as reported by their operating system, whereas the date/time value is always formatted YYYY-MM-DDThh:mm.
For more information on this input type, see the link below.
Links
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local