UX: sets min date on calendar when initial date is set (#7361)
This commit is contained in:
parent
46dc38e5a5
commit
7dd684744c
|
@ -323,11 +323,13 @@ export default Ember.Component.extend({
|
|||
focusFrom() {
|
||||
this.setProperties({ fromSelected: true, toSelected: false });
|
||||
this._setPickerDate(this.get("fromConfig.date"));
|
||||
this._setPickerMinDate(null);
|
||||
},
|
||||
|
||||
focusTo() {
|
||||
this.setProperties({ toSelected: true, fromSelected: false });
|
||||
this._setPickerDate(this.get("toConfig.date"));
|
||||
this._setPickerMinDate(this.get("fromConfig.date"));
|
||||
},
|
||||
|
||||
advancedMode() {
|
||||
|
@ -397,6 +399,17 @@ export default Ember.Component.extend({
|
|||
});
|
||||
},
|
||||
|
||||
_setPickerMinDate(date) {
|
||||
console.log("_setPickerMinDate", date);
|
||||
if (date && !moment(date, this.dateFormat).isValid()) {
|
||||
date = null;
|
||||
}
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
this._picker.setMinDate(moment(date, this.dateFormat).toDate());
|
||||
});
|
||||
},
|
||||
|
||||
_setPickerDate(date) {
|
||||
if (date && !moment(date, this.dateFormat).isValid()) {
|
||||
date = null;
|
||||
|
|
Loading…
Reference in New Issue