handlebars-helper icon indicating copy to clipboard operation
handlebars-helper copied to clipboard

ISO8601 formatDate preset

Open pushred opened this issue 10 years ago • 0 comments

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' }}

pushred avatar Jul 11 '14 18:07 pushred