sparkartgroup / handlebars-helper

A collection of Handlebars Helpers for use with Solidus
MIT License
39 stars 9 forks source link

ISO8601 formatDate preset #23

Open pushred opened 10 years ago

pushred commented 10 years ago

Inserting machine readable datetimes is sometimes needed in templates, i.e. for the <time> element's datetime attribute and similar microdata. This can also be useful when scripting. The format of course should be consistent, and ISO8601 is the best choice.

It'd be handy to have a preset for using this format rather than having to specify it by hand, i.e.

{{ formatDate date 'iso8601' }}

vs.

{{ formatDate date '%Y-%m-%dT%H:%M:%S%z' }}