-
Install Moment via
npm install --save moment
-
Add it and a template helper to your docpad configuration file
-
Use the template helper in your app
-
-
Save fizzvr/5406984 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Requires | |
moment = require('moment').lang('fr') # set locale to french | |
# Define Configuration | |
docpadConfig = | |
templateData: | |
# Format the passed date, by default format like: Thursday, November 29 2012 3:53 PM | |
formatDate: (date,format='LLLL') -> return moment(date).format(format) | |
# Export Configuration | |
module.exports = docpadConfig |
This file contains hidden or 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
This document was last modified at: <%= @formatDate(@document.date) %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment