TableExport icon indicating copy to clipboard operation
TableExport copied to clipboard

date on the csv export is at +1

Open AlexandreVa opened this issue 6 years ago • 1 comments
trafficstars

Hi,

I need to export an array in xlsx and csv. in xlsx it works fine but in csv the date is incorrect after export. i have try with class="tableexport-string" and class="tableexport-string target" but it does not work

Capture d’écran 2019-08-27 à 13 58 02 Capture d’écran 2019-08-27 à 13 58 24

thanks

AlexandreVa avatar Aug 27 '19 12:08 AlexandreVa

I faced out with the same issue, exported data in xlsx contained wrong date cells. actual date is less than 1. The problem is in function dateNum (file tableexport.js, line 486)

dateNum: function (v, date1904) { if (date1904) v += 1462; var epoch = Date.parse(v); var result = (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); return Math.floor(result); },

Incorrect rounding at the end of function - Math.floor, it should be Math.round at least.

IIIypuk09 avatar Dec 10 '19 09:12 IIIypuk09