javascript - Date.now() returns wrong date -


i have mongoose schema

const postschema= new schema({ body:{ type: string, required:true, validate:bodyvalidators}, createdby: { type: string}, to: {type:string, default:null }, createdat: { type:date, default:date.now()}, likes: { type:number,default:0}, likedby: { type:array}, dislikes: { type:number, default:0}, dislikedby: { type:array}, comments: [     {         comment: { type: string, validate: commentvalidators},         commentator: { type: string}     } ] 

});

every posts on app returns aug 20, 2017 @ 10:01 pm it's 2 hours more. here's html, i'm using angular4.

{{post.createdat | date: 'mmm dd, yyyy'}} @ {{post.createdat | date:'shorttime'}} 

i can't understand why

mongoose receiving value calculate @ time start it, instead of function. should pass function instead of running it. whenever use parenthesis executing function instead of referencing it. had same problem once.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -