Error parsing Dates in browsers with non-US location (Chrome) #2837

Closed
opened 2022-12-14 14:11:38 +00:00 by ramiroaisen · 2 comments

When parsing fields of xlsx files as dates in Chrome with a non-US location
we're getting a few seconds offsets from original Dates.

For example: We are getting a 2022-01-02 23:59:50 result for a 2022-01-03 00:00:00 date

The function we're using is

XLSX.read(base64, { type: 'base64', cellDates: true })

The issue exists when locale is set to Mumbai or Philippines, it’s unclear what locales are exhaustively affected. Issue appears to be intermittent as well.

To replicate this issue, you have to change your browser locale using the Sensor feature in the dev tools:

CMD + Shift + P

Type Sensors and choose the option Show Sensors by pressing Enter

In the Sensors tab in the console, change the location to Mumbai and reload the page.

When parsing fields of xlsx files as dates in Chrome with a non-US location we're getting a few seconds offsets from original Dates. For example: We are getting a `2022-01-02 23:59:50` result for a `2022-01-03 00:00:00` date The function we're using is ```js XLSX.read(base64, { type: 'base64', cellDates: true }) ``` The issue exists when locale is set to Mumbai or Philippines, it’s unclear what locales are exhaustively affected. Issue appears to be intermittent as well. To replicate this issue, you have to change your browser locale using the Sensor feature in the dev tools: CMD + Shift + P Type Sensors and choose the option Show Sensors by pressing Enter In the Sensors tab in the console, change the location to Mumbai and reload the page.
Owner

This ultimately stems from a Chrome bug https://bugs.chromium.org/p/v8/issues/detail?id=7863 the date handling will have to change to work around the problem

This ultimately stems from a Chrome bug https://bugs.chromium.org/p/v8/issues/detail?id=7863 the date handling will have to change to work around the problem
Owner

This should have been fixed in the 0.20.0 release -- please update (https://docs.sheetjs.com/docs/getting-started/installation/) and let us know if the issue reoccurs

This should have been fixed in the 0.20.0 release -- please update (https://docs.sheetjs.com/docs/getting-started/installation/) and let us know if the issue reoccurs
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2837
No description provided.