WhomWhomWhom
WhomWhomWhom

Reputation: 47

Moment.js displaying date incorrectly

I have a record which reads : date: "2016-02-01 00:00:05. However, when I do moment(date).format("L") the view renders 01/31/2016. Any idea why? This happens which all dates, always one day before

Upvotes: 0

Views: 161

Answers (1)

WhomWhomWhom
WhomWhomWhom

Reputation: 47

I found my answer in this post. Auto-answering in case anybody runs into the same issue. As @bschaeffer said, it was a timezone problem, this fixed it:

moment.utc(date).format('L')

Upvotes: 1

Related Questions