Input type="date" polyfill (date picker)
Looking for WET v3.1?
WET v4.0 is now the current version. There is a new location for the current page in WET v3.1.
Purpose
Provide an interface for selecting a date in a form.
Use when
This feature can be used on any page where selecting a date in a form is required.
Working example
How to implement
- Add a text input field for each date that will be requested. Each text input field must have the
date
type applied to it. - Optional: Wrap the date format in the label with
<span class="datepicker-format"></span>
to hide it when the polyfill doesn't load (due to native support). - Optional: Add a
min
attribute containing the earliest date that can be selected by the user. - Optional: Add a
max
attribute containing the latest date that can be selected by the user.
Example Code
<div>
<label for="startdate">Start Date<span class="datepicker-format"> (<abbr title="Four digits year, dash, two digits month, dash, two digits day">YYYY-MM-DD</abbr>)</span></label>
<input type="date" id="startdate" name="startdate" min="2013-03-27" max="2013-05-07" />
</div>
<div>
<label for="enddate">End Date<span class="datepicker-format"> (<abbr title="Four digits year, dash, two digits month, dash, two digits day">YYYY-MM-DD</abbr>)</span></label>
<input type="date" id="enddate" name="enddate" min="2013-03-27" max="2016-05-07" />
</div>
Configuration options
Option | Description | How to configure | Example |
---|---|---|---|
Hide Date Format | Hide the date format when the polyfill doesn't load (due to native support) | Wrap the date format in the label with:
| |
Min Date | The earliest date that can be selected by the user. | Add a "min" attribute to the input field with a YYYY-MM-DD date as the value. | |
Max Date | The latest date that can be selected by the user. | Add a "max" attribute to the input field with a YYYY-MM-DD date as the value. | |
Events
Event | Trigger | What it does |
---|---|---|
create.wb-cal | Before the calendar interface becomes visible. | Creates the calendar interface. |
setFocus.wb-cal | After the calendar interface is displayed. | Sets focus on the date in the input field, if defined. |
hideGoToFrm.wb-cal | Before the calendar interface is hidden. | Hides the "Go To" form in the calendar interface. |
Source code
- Date modified: