A
A
Alexey Yarkov2016-03-24 11:09:52
JavaScript
Alexey Yarkov, 2016-03-24 11:09:52

moment.js error?

mongoose-session stores time in ISODate("2016-03-24T07:32:40.142Z").
When trying to convert to local time like this:

var local = moment("2016-03-24T07:32:40.142Z", moment.ISO_8601).format("DD-MM-YYYY [в] HH:mm");

We get Invalid date. Moreover, if you remove .142 , then everything is OK.
Of course, I can cut this part before converting, but it seems like a crutch. This is true?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2016-03-24
@yarkov

https://en.wikipedia.org/wiki/ISO_8601
The format does not support milliseconds.
This is not a moment error.
You are not a deer.
Remove ms = everything will be fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question