sheet_to_json
converts dates differently in Chrome vs Firefox/Safari (browser difference)
#3192
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#3192
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Consider the following CSV
In Firefox and Safari, when run through SheetJS via
sheet_to_json
, it renders as:In Chrome, it renders as:
i.e., it replaces "9-2" etc. with serial numbers (https://support.microsoft.com/en-gb/office/date-systems-in-excel-e7fe7167-48a9-4b96-bb53-5612a800b487)
Using https://serialnumbertodate.com/, we can see that the serial numbers are
I have created a replication of this issue on http://alifeee.co.uk/sheetjs_error_replication/. Please view this site on both Chrome and a non-Chrome browser (Firefox or Safari). I attach Screenshots below
Chrome
Firefox (please ignore the font)
This is due to an ambiguity in the JavaScript specification.
https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-date.parse
It's likely we need to shift away from the
Date
constructor.I see. Thank you for the reply.
My overall desire was to disable date formatting overall, which I now discover you can do by setting
raw: false
.I had tried using
raw: true
(as I expected "raw values" to mean "strings", and not vice versa).The help text for
raw
, to me, was confusingas I expected "raw values" to be "strings", and was not sure what "formatted strings" meant, which is why I did not discover how to disable date-parsing.