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

sheet_to_json function changes original date format #2756

Open
hhllee opened this issue Aug 4, 2022 · 3 comments
Open

sheet_to_json function changes original date format #2756

hhllee opened this issue Aug 4, 2022 · 3 comments

Comments

@hhllee
Copy link

hhllee commented Aug 4, 2022

A user uploads an xlsx document, and one of the columns is a date, and it's displayed as "2022/7/21"
but when sheet_to_json read the xlsx, the data formats will change like this
image
How to resolve this problem
Thanks

xlsx: ^0.18.5

@SheetJS SheetJS deleted a comment from Joseph1417 Sep 13, 2022
@SheetJSDev
Copy link
Contributor

https://docs.sheetjs.com/docs/csf/features/dates#how-files-store-dates-and-times

The file itself may be using the magical format m/d/yy (which is interpreted in different ways depending on the locale).

If you want to reformat the dates, pass the option cellDates: true to generate date objects, delete the w fields for date cells and replace them with the format of your choice.

At some point we will offer a more general solution

@poemchanel
Copy link

let WorkSheet= { [SheetName]: XLSX.utils.sheet_to_json(WorkBook.Sheets[SheetName], { raw: false, }), };

i find those problem to last time, so i just add option raw: false

@aebrs
Copy link

aebrs commented Jul 31, 2023

My problem is: XLSX.utils.sheet_to_json
hexcel header is: radif date time bank kind amount refno sharh more to rest channel 1 2
body data write:1 2 radif date time bank kind amount refno sharh more to rest channel
why?

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

4 participants