I've got an Ember JS component that is supposed to render a text input with a formatted date. Here is the code I currently have:
import Ember from 'ember';
export default Ember.TextField.extend({
_value: null,
value: Ember.computed('_value', {
get() {
const value = this.get('_value');
if (value) {
return moment(value).format('L HH:mm');
}
},
set(key, value) {
this.set('_value', value);
return this.get('value');
}
})
});
called with something like {{datetime-input value=model.updatedAt}}
This renders the input fine, and I can verify via the Ember Inspector that the value
property is the formatted datetime, but the actual visible content of the input remains the raw, unformatted datetime value. What am I missing?
Aucun commentaire:
Enregistrer un commentaire