I wrote a Ember/Handlebars helper to format a date using Moment.js:
Ember.Handlebars.registerBoundHelper('formattedDate', function(date, format) {
var formattedDate = moment(date).format(format);
return new Handlebars.SafeString(formattedDate);
});
Now, I want to use that in tandem with an Ember input helper like so (where startDate is a property on the model in scope):
{{input id="startDatePicker" class="form-control" value={{formattedDate startDate 'MMM D'}} required=true}}
But that doesn't work and throws a syntax error. Is there any way to do this?
Aucun commentaire:
Enregistrer un commentaire