handlebars.js - Mandrill Templates With Handlebars - How To Format Date -
mandrill has great feature allows 1 use handlebars in templates customize email content. see docs here.
one of helpers madnrill supports date can used {{#date}}. default date format d/m/y. question how can specify different date format (e.g. yyyy)?
i need display 2015 name. tried:
{{#date yyyy}} name- displays05/31/15(default format , seems erase html after it).{{#date 'yyyy'}} name- displays{{#date 'yyyy'}} name(can't parsed).{{#date yyyy}}{{/date}} name- displays05/31/15 name(default format).{{#date 'yyyy'}}{{/date}} name- displays{{#date 'yyyy'}}{{/date}} name(can't parsed).
appreciate ;)
the issue 2-fold:
- you should use
{{date}}instead of{{#date}} - you should use double quotes formatting
the correct syntax {{date "y"}}.
mandrill updated docs provide more details on handlebars syntax.
Comments
Post a Comment