Our datepicker is flexible and fully customizable.
You can navigate through days, months and years.
It comes in two formats, an inline uib-datepicker
and an uib-datepicker-popup
to be embedded in an input.
The datepicker has 3 modes:
day
- In this mode you're presented with a 6-week calendar for a specified month.month
- In this mode you can select a month within a selected year.year
- In this mode you are presented with a range of years (20 by default).
-
custom-class (date, mode)
(Default:null
) - An optional expression to add classes based on passing a date and current mode. -
date-disabled (date, mode)
(Default:null
) - An optional expression to disable visible options based on passing a date and current mode. -
datepicker-mode
(Default:day
) - Current mode of the datepicker (day|month|year). Can be used to initialize the datepicker in a specific mode. -
format-day
(Default:dd
) - Format of day in month. -
format-month
(Default:MMMM
) - Format of month in year. -
format-year
(Default:yyyy
) - Format of year in year range. -
format-day-header
(Default:EEE
) - Format of day in week header. -
format-day-title
(Default:MMMM yyyy
) - Format of title when selecting day. -
format-month-title
(Default:yyyy
) - Format of title when selecting month. -
init-date
(Default:null
) - The initial date view when no model value is specified. -
max-date
(Default:null
) - Defines the maximum available date. -
max-mode
(Default:year
) - Sets an upper limit for mode. -
min-date
(Default:null
) - Defines the minimum available date. -
min-mode
(Default:day
) - Sets a lower limit for mode. -
ng-model
- The date object. Needs to be a Javascript Date object. -
shortcut-propagation
(Default:false
) - An option to disable the propagation of the keydown event. -
show-weeks
(Default:true
) - Whether to display week numbers. -
starting-day
(Default:0
) - Starting day of the week from 0-6 (0=Sunday, ..., 6=Saturday). -
template-url
(Default:uib/template/datepicker/datepicker.html
) - Add the ability to override the template used on the component. -
year-range
(Default:20
) - Number of years displayed in year selection. -
ng-model-options
(Default: {}) - allowInvalid support. More on ngModelOptions.
Options for the uib-datepicker must be passed as JSON using the datepicker-options
attribute. This list is only for popup settings.
-
clear-text
(Default:Clear
) - The text to display for the clear button. -
close-on-date-selection
(Default:true
) - Whether to close calendar when a date is chosen. -
close-text
(Default:Done
) - The text to display for the close button. -
current-text
(Default:Today
) - The text to display for the current day button. -
datepicker-append-to-body
(Default:false
) - Append the datepicker popup element tobody
, rather than inserting afterdatepicker-popup
. -
datepicker-popup-template-url
(Default:uib/template/datepicker/popup.html
) - Add the ability to override the template used on the component. -
datepicker-template-url
(Default:uib/template/datepicker/datepicker.html
) - Add the ability to override the template used on the component (inner uib-datepicker). -
is-open
(Default:false
) - Whether or not to show the datepicker. -
on-open-focus
(Default:true
) - Whether or not to focus the datepicker popup upon opening. -
show-button-bar
(Default:true
) - Whether or not to display a button bar underneath the uib-datepicker. -
uib-datepicker-popup
(Default:yyyy-MM-dd
) - The format for displayed dates. This string can take string literals by surrounding the value with single quotes, i.e.yyyy-MM-dd h 'o\'clock'
. -
alt-input-formats
(Default:[]
): A list of alternate formats acceptable for manual entry.
Depending on datepicker's current mode, the date may refer either to day, month or year. Accordingly, the term view refers either to a month, year or year range.
Left
: Move focus to the previous date. Will move to the last date of the previous view, if the current date is the first date of a view.Right
: Move focus to the next date. Will move to the first date of the following view, if the current date is the last date of a view.Up
: Move focus to the same column of the previous row. Will wrap to the appropriate row in the previous view.Down
: Move focus to the same column of the following row. Will wrap to the appropriate row in the following view.PgUp
: Move focus to the same date of the previous view. If that date does not exist, focus is placed on the last date of the month.PgDn
: Move focus to the same date of the following view. If that date does not exist, focus is placed on the last date of the month.Home
: Move to the first date of the view.End
: Move to the last date of the view.Enter
/Space
: Select date.Ctrl
+Up
: Move to an upper mode.Ctrl
+Down
: Move to a lower mode.Esc
: Will close popup, and move focus to the input.
Notes
If the date a user enters falls outside of the min-/max-date range, a dateDisabled
validation error will show on the form.