You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a really frustrating issue, I can't seem to reproduce.
But sometimes my helpers don't seem to load. I get all kinds of errors on pages including these global helpers e.g. "Helper isequal not defined" and the whole page goes into failrue.
I define my engine as such:
var app = express();
app.set("view engine", "handlebars");
var helpers = require("./views/helpers/handlebars");
var hbs = exphbs.create({
defaultLayout: "main",
helpers: helpers
});
app.engine("handlebars", hbs.engine);
My helper code goes as follows:
var moment = require('moment')
//helps pick value in select
exports.select = function(selected, options) {
return options.fn(this).replace(
new RegExp(' value=\"' + selected + '\"'),'$& selected="selected"');
}
//check if values are the same
exports.isequal = function (arg1, arg2, options) {
return (arg1 == arg2) ? options.fn(this) : options.inverse(this);
}
//formats date object as DD/MM/YYYY
exports.ddmmyyyy = function (date,options) {
if (moment(date)) {
return moment(date).format('DD/MM/YYYY')
} else {
return "Invalid date"
}
}
//formats date object as DD/MM/YYYY hh:mm:ss
exports.timestamp = function(date,options) {
if (moment(date)) {
return moment(date).format('DD/MM/YYYY HH:mm:ss')
} else {
return "Invalid date"
}
}
I am not sure if this is a bug, or something that I'm doing wrong.
The text was updated successfully, but these errors were encountered:
pretty much. It looks like this was developed by Yahoo employees that have since moved on. @sahat was the last one I know that was active but according to his contribution graph he seems to have dropped off of GitHub.
I have a really frustrating issue, I can't seem to reproduce.
But sometimes my helpers don't seem to load. I get all kinds of errors on pages including these global helpers e.g. "Helper isequal not defined" and the whole page goes into failrue.
I define my engine as such:
My helper code goes as follows:
I am not sure if this is a bug, or something that I'm doing wrong.
The text was updated successfully, but these errors were encountered: