Closed LukaszGrela closed 4 years ago
I like this idea but unfortunately the date parsing library I use (https://github.com/taylorhakes/fecha) does not support parsing natural language strings like now+2h
or tomorrow
. I will keep this idea in consideration for future features though.
If you just need "now" in your templates a simple helper like this will work:
const myHelpers = {
dateNow: function() {
const now = Date.now();
return fecha.format(now, 'YYYY-MM-DD HH:mm'); // or whatever date formatting library you like
}
};
const template = '{{dateNow}}';
const result = dummyjson.parse(template, { helpers: myHelpers });
I'd like to have a current date/time to be used, it could be as simple as implementing few keywords to use (
now
,nextDay
,nextWeek
,nextMonth
...)or more complicated:)
similar for the time
or more complicated:)