I have a date. 2019-12-13 13:40:00
which stands for December 13th 2019 at 1:40 pm. When I parse this with moment.js...
moment(props.data[index].date, 'gggg-MM-DD HH:mm:ss')
the _d
shows that the date is Sun Dec 13 2020 14:30:00 GMT-0800 (Pacific Standard Time)
.
I have seen many explanations on the moment GitHub where people have this issue but its related to time zones, however an entire year difference is not a time zone problem.
What can I do to fix this?
gggg
in the second argument is for parsing in ISO week date format.
Try doing moment(props.data[index].date, 'YYYY-MM-DD HH:mm:ss')