handlebars-helpers icon indicating copy to clipboard operation
handlebars-helpers copied to clipboard

`{{date}}` unexpected behaviour

Open nataliethistime opened this issue 5 years ago • 2 comments

I just started using handlebars-helpers in a project today and found that anywhere I had used date as a variable in my templates was now returning the current date (instead of my expected values). This surprised me as it seemed from the documentation that date was itself not a function... Is this intended behaviour?

I am happy to submit a patch for the docs if this is indeed expected behaviour. Feel free to close this if I'm on the wrong track though...

Thanks!

nataliethistime avatar Jan 19 '20 11:01 nataliethistime

Same here! Any hint about this?

In my case I don't have problem locally but on preprod or prod the helper returns the current date

maintux avatar Mar 04 '20 12:03 maintux

I have this in my code (which just removes the date helper)

const handlebarsHelpers = require('handlebars-helpers');

//
// Delete the `date` helper so that it doesn't get confused with template variables named `date`.
//
let helpers = handlebarsHelpers();
delete helpers.date;

app.engine('handlebars', handlebars({ helpers }));
app.set('view engine', 'handlebars');

nataliethistime avatar Mar 04 '20 20:03 nataliethistime