Solvedsheetjs Date conversion loses 1 day

Hello,

when I import a specific xlsx file some of the dates are imported correctly and others get a wrong date which is [(date in file) - 1 day].

Attached you'll find a file (test.xlsx) that only contains two rows of data. The first one (row no. 4) imports fine and the second (row no. 5) leads to the error. You can see this in column J which is called 'Order date'.

If I look in the Chrome Javascript Debugger the imported field seems to have an associated timezone information. I've tried to transfer the number formating in Excel from a working cell to the non working cells but this had no effect. While importing the data it doesn't make any change if I use readtype.raw true or false.

I'm using Win10, Chrome 73.0.3683.86 and version 0.14.0 of js-xlsx.

22 Answers

✔️Accepted Answer

My date in excel is 2019-03-04 and finally i got 2019-03-03T15:59:17.000Z when XLSX.utils.sheet_to_json. It should be 2019-03-03T16:00:00.000Z , my timezone is +8

excel 的时间从 1900/1/0(1899/12/30)开始 ,此时对中国用的上海时区(GMT+0805)+8:05:43,1800~1900年。https://www.timeanddate.com/time/zone/china/shanghai

getTimezoneOffset 获取的分钟数,忽略了43秒,所以会少 43 秒
https://github.com/SheetJS/ssf/blob/master/bits/35_datecode.js

Other Answers:

My date in excel is 2019-03-04 and finally i got 2019-03-03T15:59:17.000Z when XLSX.utils.sheet_to_json. It should be 2019-03-03T16:00:00.000Z , my timezone is +8

More Issues: