Open harrisonyao opened 11 years ago
Sorry for the wrong expression, it should be "<%=: varObj | dateformat:'yyyy-MM-dd hh:mm:ss' %>" , but the issue is still there ^-^
If you're formatting dates, I would export momentjs into the view, I would just do this: app.locals.moment = require('moment');
then in your view, you can do <%= moment(foo.created_at).fromNow() %>
that's fine and it works, thanks a lot :-) , but it is still a issue ( or risk ) for filters in ejs template when used with the parameter will include colon. Hopes any changes on it ....
Did you try escaping them? :
ah yeah that's definitely a bug
Hi there,
I was encountered the issue about the conflicts with ejs filter expression, eg: one expression with the content: <%=: varObj | dateformat 'yyyy-MM-dd hh:mm:ss' %> and the first colon with the tag "<%=:" is the filter tag in ejs, but the customized filter which named as "dateformat" will accept the format string some like the pattern "yyyy-MM-dd hh:mm:ss", and the format pattern string have the colons also as the parameter which will be passed into the filter function, so ejs will give the error stack info as: "500 SyntaxError: Unexpected token : "
So, it is just a advice that to enable the customized the filter express tag with ejs template file in ejs engine configurations.
Thanks, -Harrison