The add-on provides you a date input component based on amazing bootstrap-datepicker library. It supports popup and inline mode, and can be used in Ember CLI applications.
It doesn't have any external dependecy except bootstrap-datepicker.
If you are using Ember CLI 0.2.3 or higher, just run within your project directory:
ember install ember-cli-bootstrap-datepicker
If your Ember CLI version is greater than 0.1.5 and less than 0.2.3, run the following within your project directory:
ember install:addon ember-cli-bootstrap-datepicker
When your Ember CLI version is below 0.1.5, please run within your project directory:
npm install --save-dev ember-cli-bootstrap-datepicker
ember generate bootstrap-datepicker
Basic example:
Use separate component for inline mode:
The component supports many options of the bootstrap-datepicker library. Let me show you how to use them ✨
Type: Boolean
Default: false
Type: Boolean
Default: false
Type: Boolean
Default: false
Type: Array
or String
Default: ""
or []
Type: Date
or String
Default: Infinity
(end of time)
Type: Boolean
Default: true
Type: String
Default: 'mm/dd/yyyy'
Type: Boolean
Default: true
Type: String
Default: 'en'
When you need another language, you should import a locale file using your Brocfile.js. Just import bower_components/bootstrap-datepicker/js/locales/bootstrap-datepicker.<LANGUAGE_CODE>.js
, e.g.:
// Brocfile.js
app.import('bower_components/bootstrap-datepicker/js/locales/bootstrap-datepicker.de.js');
Type: Number
or String
Default: 0
or 'days'
Type: String
Default: 'auto'
Type: Date
or String
Default: -Infinity
(beginning of time)
Type: Number
or String
Default: 0
or 'month'
Type: Boolean
or String
Default: false
If true or “linked”, displays a “Today” button at the bottom of the datepicker to select the current date. If true, the “Today” button will only move the current date into view; if “linked”, the current date will also be selected. More...
Type: Boolean
Default: false
Type: Number
Default: 0
(Sunday)
The changeDate action is triggered when the selected date changes. It can be specified like this:
The action can be handled by a parent component, controller or route:
actions: {
changeDateAction(date) {
// do sth with the new date
}
}
The clearDate action is triggered when the date is cleared (e.g. when the "clear" button is clicked).
The action can be handled by a parent component, controller or route:
actions: {
clearDateAction() {
// do sth
}
}
The focus-in and focus-out actions are triggered when the respective focus events occur on the input field.
The actions can be handled by a parent component, controller or route:
actions: {
focusInAction(component, event) {
// handle event
},
focusOutAction(component, event) {
// handle event
}
}
The hide and show actions are triggered when the datepicker is either hidden or displayed.
The actions can be handled by a parent component, controller or route:
actions: {
hideAction() {
// datepicker is hidden
},
showAction() {
// datepicker is shown
}
}
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
The add-on is based on bootstrap-datepicker.