我正在制作一个带有聊天和帖子的应用程序,在聊天中,我想要显示最近一篇帖子的时间。下面是我的posts的mongoose模式的日期部分,以及我的Mongodb日期字段的图片。我正在尝试将日期发送到前端,但不确定如何格式化它。我想格式化它作为昨天下午12:45或6天前等。任何帮助是非常感谢。Mongoose Schema field for date:
d
我想比较一下MongoDB和我约会的日期。 today: function() { return Posts.find({createdAt : { $created in "future" , so this function must return nothing
createdAt = moment().format();//