Datepicker
Design
Datepickers are used to capture date information and date configure settings.
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 programmatically change datepicker with the Javascript methods. |
Example of setting the date with the
|
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, dateInput (yyyy-mm-dd) or date object | Sets the date programmatically. |
|
| setRangeMin | elementSelector, dateInput (yyyy-mm-dd) or date object | Sets the date range minimum programmatically. |
|
| setRangeMax | elementSelector, 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