Open raquelgs opened 5 years ago
When setting the locale to en-GB the date is parsed 4 hours before expected:
en-GB
const stringDate = "05/22/2000"; const gb = Sugar.Date.create(stringDate, { fromUTC: true, locale: "en-GB" }); const us = Sugar.Date.create(stringDate, { fromUTC: true, locale: "en-US" }); console.log(gb.toISOString()); // Output: 2000-05-21T20:00:00.000Z console.log(us.toISOString()); // Output: 2000-05-22T00:00:00.000Z
We expect both console.log to be the identical (2000-05-22T00:00:00.000Z).
2000-05-22T00:00:00.000Z
Is this the expected behaviour? If that's the case, do you know why setting locale to en-GB is changing the parsed date?
When setting the locale to
en-GB
the date is parsed 4 hours before expected:We expect both console.log to be the identical (
2000-05-22T00:00:00.000Z
).Is this the expected behaviour? If that's the case, do you know why setting locale to
en-GB
is changing the parsed date?