Date Format Change Issue #3035
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#3035
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?
I am using SheetJS's 'xlsx.full.min.js' Library from last 2 Years for exporting HTML Table data to Excel (.xlsx) file. Now suddenly I am facing Date issue for Example if My HTML Table Contains Date '01/04/2023' (e.g. 1st April 2023)Then it will export as 04/01/2023. Please help me to rectify the problem. Following is Script and Libraries I use for exporting data to Excel File.
Parsing dates has changed over the years. If you want to ensure that the correct dates are passed, there are two approaches:
A) pass the option
raw: true
. This ensures that each cell is parsed as if they were strings (avoiding value interpretation). This is explained in https://docs.sheetjs.com/docs/api/utilities/html#create-new-sheetB) Override the values https://docs.sheetjs.com/docs/api/utilities/html#value-override
For a date object, you can use the following attributes to the
td
element:data-t="d"
ensures that the cell is interpreted as a datedata-v="2023-11-25T07:59:00.000Z"
the date value is specified as an ISO date. You can get this value usingdate.toISOString()
from JavaScript code (or let the backend generate the string)data-z="dd-mm-yyyy"
forces the number format.After setting the attributes in your table, call
table_to_book
with the optionUTC: true