I'm parsing a date like this. The locale of moment is set to Germany:
moment("2030-12-31T23:59:59.000Z")
However when I print it it will select the next day:
moment("2030-12-31T23:59:59.000Z").format('L')
-> "01.01.2031"
This is what the moment object looks like after the parse and where we can clearly see that the parsed date is correct:
Moment {_isAMomentObject: true, _i: "2030-12-31T23:59:59.000Z", _f: "YYYY-MM-DDTHH:mm:ss.SSSSZ", _tzm: 0, _isUTC: false, …}
_d
:
Wed Jan 01 2031 00:00:00 GMT+0100 (CET) {}
_f
:
"YYYY-MM-DDTHH:mm:ss.SSSSZ"
_i
:
"2030-12-31T23:59:59.000Z"
_isAMomentObject
:
true
_isUTC
:
false
_isValid
:
true
_locale
:
Locale {_calendar: {…}, _longDateFormat: {…}, _invalidDate: "Invalid date", _ordinal: "%d.", _ordinalParse: /\d{1,2}\./, …}
_pf
:
charsLeftOver
:
0
empty
:
false
invalidFormat
:
false
invalidMonth
:
null
iso
:
true
meridiem
:
undefined
nullInput
:
false
overflow
:
-1
parsedDateParts
:
(7) [2030, 11, 31, 23, 59, 59, 0]
unusedInput
:
[]
unusedTokens
:
[]
userInvalidated
:
false
__proto__
:
Object
_tzm
:
0
__proto__
:
Object
Funnily I'm parsing 2-3 more dates exactly the same way (most January 1. of some year) and they work fine!
It's not a UTC thing I believe.
What is happening here?