You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Edit: I just saw the reply on #1522 (comment). I think the problem I am experiencing here is the one described there. If this is true, then this issue can be closed!
Given the following code:
const eightOClock = new Date('2021-09-14T06:00:00.000Z'); // argument is ISO 8601 date string
const testWS = XLSX.utils.json_to_sheet([{firstName: 'John', 'date': eightOClock}], {});
XLSX.utils.book_append_sheet(wb, testWS, 'testWS');
XLSX.writeFile(wb, 'test.xlsx');
The time value of const eightOClock is 0.33375. But when formatting it (e.g. using https://customformats.com as linked in the demo), and applying custom format hh:mm:ss to it, 0.33375 is formatted 08:00:36, which is right, but it is wrong for me, as it adds 36 seconds to the time in the date I initially provided. Now my question: Why is a date as number not presented more precisely when converting the actual JS date using json_to_sheet()?
I experience the same issue when doing it like this:
It still shows the date in the excel file as 14.09.2021 08:00:36, even when the date initially was 14.09.2021 08:00:00 in JS. So, 36 seconds have been added to that, even when the type of cell B2 is d and the value is the JS date.
Thank you in advance.
Help is much appreciated!
The text was updated successfully, but these errors were encountered:
Edit: I just saw the reply on #1522 (comment). I think the problem I am experiencing here is the one described there. If this is true, then this issue can be closed!
Given the following code:
returns
The time value of
const eightOClock
is 0.33375. But when formatting it (e.g. using https://customformats.com as linked in the demo), and applying custom formathh:mm:ss
to it,0.33375
is formatted08:00:36
, which is right, but it is wrong for me, as it adds 36 seconds to the time in the date I initially provided. Now my question: Why is a date as number not presented more precisely when converting the actual JS date using json_to_sheet()?I experience the same issue when doing it like this:
Even when, in the browser, it looks like this:
It still shows the date in the excel file as
14.09.2021 08:00:36
, even when the date initially was14.09.2021 08:00:00
in JS. So, 36 seconds have been added to that, even when the type of cell B2 isd
and the value is the JS date.Thank you in advance.
Help is much appreciated!
The text was updated successfully, but these errors were encountered: