You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expectation: "Moment's string parsing functions like moment(string) and moment.utc(string) accept offset information if provided, but convert the resulting Moment object to local or UTC time. In contrast, moment.parseZone() parses the string but keeps the resulting Moment object in a fixed-offset timezone with the provided offset in the string. " derived from moment docs
locale: EST moment.parseZone("2023-01-20T00:00:00.000Z") // output Fri Jan 20 2023 00:00:00 GMT+0000
Actual: moment.parseZone() applies the timezone difference to the moment it creates in addition to converting the timezone to local. moment.parseZone("2023-01-20T00:00:00.000Z") // output Thu Jan 19 2023 14:00:00 GMT-0500
The text was updated successfully, but these errors were encountered:
I am sorry for the confusion. Let me clarify. The defect concerns moment(string) vs moment.parseZone(string). You are correct that moment() and moment.parseZone() are identical in behavior and working as expected, but unfortunately, it's irrelevant to the defect I provided. Please read over my issue again and let me know if you have any questions. Thanks!
Where are you seeing the reported output? moment.parseZone() returns a moment object, which still needs further formatting to produce a string (e.g. by using .format(string) or .toISOString()).
In my environment using moment 2.29.4 I get the following results:
Expectation: "Moment's string parsing functions like moment(string) and moment.utc(string) accept offset information if provided, but convert the resulting Moment object to local or UTC time. In contrast, moment.parseZone() parses the string but keeps the resulting Moment object in a fixed-offset timezone with the provided offset in the string. " derived from moment docs
locale: EST
moment.parseZone("2023-01-20T00:00:00.000Z") // output Fri Jan 20 2023 00:00:00 GMT+0000
Actual: moment.parseZone() applies the timezone difference to the moment it creates in addition to converting the timezone to local.
moment.parseZone("2023-01-20T00:00:00.000Z") // output Thu Jan 19 2023 14:00:00 GMT-0500
The text was updated successfully, but these errors were encountered: