I make a blog information, and I need display the date any author post article. And I try to use moment package:
meteor add momentjs:moment
then I execute:
Meteor.methods({
postInsert: (postAttributes) => {
check(postAttributes, {
title: String,
summary: String,
content: String,
img: String,
categoryMain: String,
sub_categories: String
});
let user = Meteor.user();
let post = _.extend(postAttributes, {
userId: user._id,
author: user.username,
submitted: moment().format("MMM Do YY",
});
var postId = Posts.insert(post);
return {
_id: postId
};
},
});
But it can show the time when I display by spacebar {{ sumitted }}.
Can you help me to display it.
Thanks.