Design
Date Pickers are used to capture date information and date configure settings. They are usually used within Forms.
Code
Example | Element | Code |
---|---|---|
|
Default datepicker input. |
Just the date picker:
In a form group:
Just the date picker:
|
|
A custom date format can be set. |
Set the Just the date picker:
In a form group:
Set the Just the date picker:
In a form group:
|
|
Custom text for the Date Picker's action button (mostly used for i18n). |
Set the Just the date picker:
In a form group:
Set the Just the date picker:
In a form group:
|
|
To restrict the date range, set the minimum and maximum allowable dates. |
Set the Just the date picker:
In a form group:
Set the Just the date picker:
In a form group:
|
|
You can programmatically change datepicker with the Javascript methods. |
Example of setting the date with the
|
|
You can listen for changes by binding to the original date picker input (note, this is not the visible vanity input). |
Example using jQuery
|
Custom date formats
Value | Description | Example output |
---|---|---|
%Y | Full length year | 2015 |
%y | Two digit year | 15 |
%m | Two digit month | 05 |
%d | Two digit day | 01 |
Javascript methods
Function | Arguments | Description | Example |
---|---|---|---|
init | elementSelector | Bind all the events to date picker. |
|
destroy | elementSelector | Removes the event bindings. |
|
setDate | elementSelector (the div wrapper selector), dateInput (yyyy-mm-dd) or date object | Sets the date programmatically. |
|
setRangeMin | elementSelector (the div wrapper selector), dateInput (yyyy-mm-dd) or date object | Sets the date range minimum programmatically. |
|
setRangeMax | elementSelector (the div wrapper selector), dateInput (yyyy-mm-dd) or date object | Sets the date range maximum programmatically. |
|
Dependencies
- jQuery 1.10.2 http://jquery.com/
- Yet Another Datepicker https://github.com/freqdec/datePicker