Merge pull request #3957 from tgxworld/allow_opts_to_datepicker

Allow date-picker component to be extended with custom options.
This commit is contained in:
Régis Hanol 2016-01-13 15:51:34 +01:00
commit 50408bc7a1
1 changed files with 9 additions and 3 deletions

View File

@ -12,13 +12,15 @@ export default Em.Component.extend({
const input = this.$()[0];
loadScript("/javascripts/pikaday.js").then(() => {
this._picker = new Pikaday({
const default_opts = {
field: input,
format: "YYYY-MM-DD",
defaultDate: moment().add(1, "day").toDate(),
minDate: new Date(),
onSelect: date => this.set("value", moment(date).format("YYYY-MM-DD")),
});
onSelect: date => this.set("value", moment(date).format("YYYY-MM-DD"))
};
this._picker = new Pikaday(Object.assign(default_opts, this._opts()));
});
},
@ -27,4 +29,8 @@ export default Em.Component.extend({
this._picker = null;
},
_opts: function() {
return null;
}
});