Date imported with cellDates set to true is off by a fraction of a second #2910
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#2910
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
I am importing an Excel file with a Date cell:
cellDates is set to true:
XLSX.read(data, {type: 'array', cellDates: true})
Accessing the cells value contains an incorrect Date object which is off by a fraction of a second:
let cell = workbook.Sheets[sheetName]["A2"];
cell.v is "2023-01-30T20:59:59.999Z" while it should be "2023-01-30T21:00:00.000Z"
Please find attached the used Excel file and the HTML example used to reporduce the issue
Is there any workaround for this issue or any hint where to fix this in the source code?
Do you accept Merge Requests?
This should work correctly in 0.20.0, as verified on the websites https://oss.sheetjs.com/ and https://oss.sheetjs.com/sheetjs/
If you are getting the wrong results on the live website, please share your current IANA timezone (run
Intl.DateTimeFormat().resolvedOptions().timeZone
in your browser console) and we can take a closer look