drudge / mongoose-timestamp

Adds createdAt and updatedAt date attributes that get auto-assigned to the most recent create/update timestamp
Other
308 stars 64 forks source link

Use new Date.now() vs new Date() #23

Closed alexprice1 closed 9 years ago

alexprice1 commented 9 years ago

new Date() returns the server's time. You should use Date.now(), it returns the UTC time:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now

drudge commented 9 years ago

IIRC, mongo only stores dates in UTC time.