Handlebars Helpers
Sugartime
Save a date using sugartime syntax
Overview
This helper outputs a date in a specified format according to the human time explanation.
It uses the Sugar.js Date library to parse the human date text.
You can use the interactive tool the this page to test the human date text.
The format uses the moment.js format.
When concatenating more than one human time phrase, ensure each phrase is separated by a coma.
Concatenating
Concatenating, stringing more that one phrase together, allows you to do quite complex sugartime calculations.
It calculates working from left to right, starting with the left most phrase. The result of the first phrase calculation is used as the starting point for the 2 second phrase calculation. It will continue until there is nothing left to calculate.
Syntax
Basic Example
Basic example will output the date in default format "YYYY-MM-DD HH:mm:SS" according to the human time explanation.
Usage
Substitution
Concat Example
Concat example will output the date in default format "YYYY-MM-DD HH:mm:SS" according to the human time explanation that is given in parts
Usage
Substitution
Format Example
Format example will output the date in a specified format "YYYY-MM-DD".