Format date in Meteor Handlebars bracers {{ timestamp }}
Use a handlebars helper:
Template.registerHelper("prettifyDate", function(timestamp) {
return new Date(timestamp).toString('yyyy-MM-dd')
});
Then in your html:
{{prettifyDate timestamp}}
If you use moment:
Template.registerHelper("prettifyDate", function(timestamp) {
return moment(new Date(timestamp)).fromNow();
});
This works for me.
toString("yyyy-MM-dd") - doesn't convert it.
Template.registerHelper("prettifyDate", function(timestamp) {
var curr_date = timestamp.getDate();
var curr_month = timestamp.getMonth();
curr_month++;
var curr_year = timestamp.getFullYear();
result = curr_date + ". " + curr_month + ". " + curr_year;
return result;
});