-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong time when exporting dates with json_to_sheet #1522
Comments
enter date in mm-dd-yyyy hh:mm:ss format in excel and convert into new date(excelDate); |
This also happens aoa_to_sheet in version 0.15.1 I couldn't figure out how to fix this or make sense of Khalsa's comment. |
Same here, using XLSX.utils.json_to_sheet |
**i convert some columns of excel in text formathope it's help you |
I have the same issue. Given the following code:
In the browser, when I do console.log(ws), it gives me:
When I open the excel file, it says
So, even when the date is correct in the browser, the date is wrong in the excel file. Thank you in advance. |
Most of these sub-minute issues are a result of a v8 bug: https://bugs.chromium.org/p/v8/issues/detail?id=7863 The anchor date is at the end of the year 1899 (corresponding to Excel's zero date). For a huge number of timezones, there were sub-minute changes to the offset from UTC. Thanks to the v8 bug, the date calculations are incorrect. Closing in favor of #1565 -- please follow up there |
Hi!
I'm having issues with times when exporting dates in a .xlsx workbook.
My original dates are retrieved from my server as strings like this one: '2019-05-30T03:00:00.000Z'
Before generating my .xlsx file, I convert all those string dates to javascript date objects:
let deliveryDate = new Date('2019-05-30T03:00:00.000Z')
And then I generate my worksheet using the following command:
XLSX.utils.json_to_sheet(json, {dateNF: 'dd/MM/yyyy'})
The problem is that the exported dates are being formatted with wrong times, and this implies into wrong dates when it's midnight.
For example, the above mentioned date string generates the following output in the worksheet:
'5/29/2019 23:59:32'
The hour difference is because of my device's location settings, but the minutes and seconds are being formatted wrongly and I just can't identify why.
Does anyone know why is this happening and how can I solve this?
Thanks!
The text was updated successfully, but these errors were encountered: