Date and time picker addon based on bootstrap. It uses bootstrap-datetimepicker and moment.js.
- Node.js 8, 10 or 12
- Bootstrap 3
- Ember 3+
ember install ember-cli-bootstrap-datetimepicker
For demonstration see bootstrap-datetimepicker
Basic example:
Returns: date
, null
Fired when the date is changed.
Returns: null
Fired when the date picker is hidden.
Returns: null
Fired when the date picker is shown.
Default: false
Accepts: boolean
If true
, the picker will show on textbox focus and icon click when used in a button group.
Default: false
Accepts: boolean
Shows the week of the year to the left of first day of the week.
Default: null
Accepts: date
, moment
, string
Sets the picker date/time.
Default: []
Accepts: array
of [number
]
Disables selection of days in the array, e.g. sundays.
Default: false
Accepts: boolean
Disables the input element.
Default: false
Accepts: array
of [date
, moment
, string
]
Disables / enables selection of dates in the array, e.g. holidays.
When updating the value, the array should be of type date
.
Default: false
Accepts: array
of [number
]
Disables / enables selection of hours in the array, affecting all days.
Default: false
Accepts: array
of [string
]
Allows for several input formats to be valid. Accepts an array of valid input moment format options.
Default: true
Accepts: boolean
If false
, the textbox will not be given focus when the picker is shown.
Default: false
Accepts: string
See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY
will not display the time picker.
Defaults: component defaults
'ember-cli-bootstrap-datetimepicker': {
icons: {
next: 'chevron right',
previous: 'chevron left'
}
}
Replaces icon classes globally.
Supported icons include clear
, close
, date
, down
, next
, previous
, time
, today
and up
.
If inner html has to be set (Material Icons), use ::after
pseudo selector.
Note: When using only the time picker, pass isTime=true
so that the correct icon is displayed.
Defaults: component defaults
Default: moment.locale()
Accepts: string
, moment.local('locale')
Use the specified locale for text rendering.
Note: When using localization, add includeLocales
to config/environment.js
.
Cherry pick locales (optimal)
moment: {
includeLocales: ['de', 'fr']
}
Include all locales
moment: {
includeLocales: true
}
Default: false
Accepts: date
, moment
, string
Prevents date/time selections after this date.
Default: false
Accepts: date
, moment
, string
Prevents date/time selections before this date.
Default: false
Accepts: boolean
Opens the picker on input focus.
Default: false
Accepts: boolean
Show the Clear button in the icon toolbar.
Clicking the Clear button will set the calendar to null
.
Default: false
Accepts: boolean
Show the Close button in the icon toolbar.
Clicking the Close button will call hide()
.
Default: false
Accepts: boolean
Show the Today button in the icon toolbar.
Clicking the Today button will set the calendar view and set the date to now
.
Default: false
Accepts: boolean
Show calendar and time side by side.
Default: ''
Accepts: string
Set timezone.
Default: { today: 'Go to today', clear: 'Clear selection', close: 'Close the picker', selectMonth: 'Select Month', prevMonth: 'Previous Month', nextMonth: 'Next Month', selectYear: 'Select Year', prevYear: 'Previous Year', nextYear: 'Next Year', selectDecade: 'Select Decade', prevDecade: 'Previous Decade', nextDecade: 'Next Decade', prevCentury: 'Previous Century', nextCentury: 'Next Century', pickHour: 'Pick Hour', incrementHour: 'Increment Hour', decrementHour: 'Decrement Hour', pickMinute: 'Pick Minute', incrementMinute: 'Increment Minute', decrementMinute: 'Decrement Minute', pickSecond: 'Pick Second', incrementSecond: 'Increment Second', decrementSecond: 'Decrement Second', togglePeriod: 'Toggle Period', selectTime: 'Select Time' }
Accepts: object
with one or all of the parameters above
Default: false
Accepts: boolean
, 'year', 'month', 'day', 'hour', 'minute'
If the date is not set, the first time the widget opens will set the date
to current moment (if true
). Granularity can be specified as a string
.
Default: false
Accepts: date
, moment
, string
Pre-set the date / time, allowing to change default time from 12:00 AM.
Default: days
Accepts: 'years', 'months', 'days'
The default view to display when the picker is shown.
Note: To limit the picker to selecting, for instance the year and month, use format: MM/YYYY
.
Default: null
Accepts: string or jQuery object
On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: 'relative'.
Default: { horizontal: 'auto', vertical: 'auto' }
Accepts: object
with one or all of the parameters above
(horizontal: 'auto', 'left', 'right' / vertical: 'auto', 'top', 'bottom')
Will position widget according to the parameters given in object.
Default: true
Accepts: boolean
Show calendar or time icon after input.