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

Excel sheet to json date issue: dd/mm/yyyy changed to mm/dd/yyyy #1432

Closed
manojmkv opened this issue Feb 20, 2019 · 2 comments
Closed

Excel sheet to json date issue: dd/mm/yyyy changed to mm/dd/yyyy #1432

manojmkv opened this issue Feb 20, 2019 · 2 comments

Comments

@manojmkv
Copy link

Hi,
In my excel file date format is dd/mm/yyyy but FileReader object is returning mm/dd/yyyy. I tried all fixes provided by you in Issue ID: #703 but did not work. I feel there is an issue with File reader. Here is my code snippet:

var cfb = XLSX.read(binary, {
type: 'binary',
cellDates: true,
dateNF: 'dd/mm/yyyy'
});
var sCSV = '';
var sCSVData = '';
if (cfb.SheetNames.length > 1) {
$scope.sheetExcess = true;
}
cfb.SheetNames.forEach(function (sheetName) {
sCSV = XLSX.utils.sheet_to_row_object_array(cfb.Sheets[sheetName], {raw: false});
sCSVData = XLSX.utils.sheet_to_json(cfb.Sheets[sheetName], {
header: 1
});
var xlData = sCSV;

Let me know if you see anything missing in my code.

@Alcoine
Copy link

Alcoine commented Apr 8, 2019

XLSX.utils.json_to_sheet(output, { dateNF: "YYYY-MM-DD HH:mm:ss" });

you can change it to dateNf: "DD-MM-YYYY";

@reviewher
Copy link
Contributor

This seems to be same issue as #1005

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