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

Open
opened 2 months ago by ramiroaisen · 1 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
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2837
Loading…
There is no content yet.