Skip to content
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

Exporting Date-Times is wrong #1890

Closed
vinodjoshi11 opened this issue Apr 7, 2020 · 2 comments
Closed

Exporting Date-Times is wrong #1890

vinodjoshi11 opened this issue Apr 7, 2020 · 2 comments

Comments

@vinodjoshi11
Copy link

i am facing date time issue
I have try this code xlsx js
let wb = XLSX.utils.book_new();
let ws = XLSX.ws = XLSX.utils.json_to_sheet(exportXLSXData, {dateNF: 'mmm dd, yyyy hh:mm', cellDates: true });
/*var ws = XLSX.utils.json_to_sheet(exportdata, {header: ["string","string", "number","date","string","string","string","string","string","string","string","string",], cellDates: true}); */
// Headers
ws['A1'].v = "Issue Key";
ws['B1'].v = "Summary";
ws['C1'].v = "Time Spent (Hours)";
ws['D1'].v = "Date";
ws['E1'].v = "Work Description";
ws['F1'].v = "Task Type";
ws['G1'].v = "User";
ws['H1'].v = "Account";
ws['I1'].v = "Parent Issue Key";
ws['J1'].v = "Issue Type";
ws['K1'].v = "Issue Status";
ws['L1'].v = "Issue Priority";
ws['M1'].v = "Issue Reporter";
ws['N1'].v = "Project Key";
ws['O1'].v = "Project Name";
ws['P1'].v = "Component";
ws['Q1'].v = "All Components";
ws['R1'].v = "Fix Version";
ws['S1'].v = "All Fix versions";
for (var i = 0; i < exportXLSXData.length; ++i) {
ws[D${i + 2}].z = 'mmm dd, yyyy hh:mm';
ws[D${i + 2}].t= 'd';
}
ws['!cols'] = wscolls;
ws['!rows'] = allRows;console.log(ws)
XLSX.utils.book_append_sheet(wb, ws, sheetNames);
XLSX.writeFile(wb,fileName + EXCEL_EXTENSION);
any bdy can help me ?
I have add utc date
"Mar 10, 2020 08:00"

the output excels file date i have found wrong?
Mar 10, 2020 07:59

@vinodjoshi11 vinodjoshi11 changed the title Exporting Date-Times format is wrong Exporting Date-Times is wrong Apr 7, 2020
@metuuu
Copy link

metuuu commented May 19, 2020

Try XLSX.writeFile(wb,fileName + EXCEL_EXTENSION, { cellDates: true })

https://github.com/SheetJS/sheetjs#data-types

Type d is the Date type, generated only when the option cellDates is passed.

cellDates param isn't documented clearly enough in my opinion.
The code should give some kind of warning atleast when date type is being exported without cellDates param.

@reviewher
Copy link
Contributor

https://bugs.chromium.org/p/v8/issues/detail?id=7863 V8 bug. SheetJS has to work around it.

Closing in favor of #1565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants