Skip to content

Instantly share code, notes, and snippets.

@turboclaw
Created March 3, 2014 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboclaw/9334502 to your computer and use it in GitHub Desktop.
Save turboclaw/9334502 to your computer and use it in GitHub Desktop.
Simple HBS/Moment.js helper
// use in .hbs template: {{localeFormattedDate dateToConvert}}
Handlebars.registerHelper("localeFormattedDate", function( context, block ) {
if ( window.moment ) {
return moment( Date(context) ).format( config.locale.dateFormat );
}else{
return context;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment