Created
March 3, 2014 20:59
-
-
Save turboclaw/9334502 to your computer and use it in GitHub Desktop.
Simple HBS/Moment.js helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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