I'm having a problem with the moment js using the assemble.io helpers. The software we use allows us to use these helpers to customize our documents. I'm trying to add days to a date. I want our invoice to add 30 days to the invoice date as the due date. Here is what I've tried:
InvoiceDate is the var that the software uses to pull in the date.
{{moment InvoiceDate add="30, 'd'" format="MMM DD, YYYY"}}
{{moment InvoiceDate add="30, 'days'" format="MMM DD, YYYY"}}
What am I doing wrong?
http://assemble.io/helpers/helpers-dates.html https://momentjs.com/docs/
From looking at the README.md examples for the moment helper, the value being passed to the
addproperty needs to be an object with the key being the granularity ("days") and the value being the amount (30).You can't format an object as a literal in Handlebars, so the data will need to be passed in somehow. If you're using software that handles frontmatter, then you can do something like this:
Otherwise, you'll have to somehow include the modifier on your context for Handlebars to see: