So I am using two inputs fields and .
One returns date in 10 digits and one returns time in this format, e.g.) "09:23".
I would like to use computed properties with custom getters/setters to create Date() object.
activeFromDate: computed('model.active_from', {
get() {
// If model.active_from currently exists and is a JavaScript Date object, extract the date number
// from it to pass to the `date-picker` component
if (this.get('model.active_from')) {
return doSomethingToGetDateNumberFromTimestamp();
}
},
set(key, value) {
// When the `date-picker` component updates the value, create a new Date object in the alert model
this.set('model.active_from', doSomethingToGetTimestampFromDateString());
return value;
}
}),
activeFromTime...,
modal.active_from
is where date&time needs to be saved on.
Aucun commentaire:
Enregistrer un commentaire