excel sheet date field lost first 2 digit #208

Closed
opened 2015-04-15 21:38:05 +00:00 by jerryphe88 · 3 comments
jerryphe88 commented 2015-04-15 21:38:05 +00:00 (Migrated from github.com)

In the excel sheet, let's say there is a column with values of date type. In the values of date type, let us say one value is '4/15/2015'. When SheetJS gets the json data(use the api xlsxUtil.sheet_to_json(rosterFile.Sheets[rosterSheet])), the value '4/15/2015' is not there, but '4/15/15' is in the json. So it seems '2015' lost the first '20'. Is this a feature or bug?

Thanks
Jerry

In the excel sheet, let's say there is a column with values of date type. In the values of date type, let us say one value is '4/15/2015'. When SheetJS gets the json data(use the api xlsxUtil.sheet_to_json(rosterFile.Sheets[rosterSheet])), the value '4/15/2015' is not there, but '4/15/15' is in the json. So it seems '2015' lost the first '20'. Is this a feature or bug? Thanks Jerry
SheetJSDev commented 2015-04-15 23:45:59 +00:00 (Migrated from github.com)

@jerryhe88 I suspect this is the same as https://github.com/SheetJS/js-xlsx/issues/200 and https://github.com/SheetJS/js-xlsx/issues/181. To be sure, if you manually change the format for code 14 (see https://github.com/SheetJS/js-xlsx/issues/181#issuecomment-76733831) to 'm/d/yyyy', do you see 2 or 4 digits?

@jerryhe88 I suspect this is the same as https://github.com/SheetJS/js-xlsx/issues/200 and https://github.com/SheetJS/js-xlsx/issues/181. To be sure, if you manually change the format for code 14 (see https://github.com/SheetJS/js-xlsx/issues/181#issuecomment-76733831) to 'm/d/yyyy', do you see 2 or 4 digits?
jerryphe88 commented 2015-04-16 13:25:39 +00:00 (Migrated from github.com)

thanks for quick reply. Not sure what needs to do after reading #200 and #181.
The below is the file and code:
filePath.xlsx has data like '4/15/2015';
var fileContent = xlsx.readFile(filePath.xlsx);
var rowDatas = xlsxUtil.sheet_to_json(fileContent.Sheets['Template']);

after the above,
rowDatas has '4/15/15'. Can you please provide sample codes or configs so that rowDatas can have '4/15/2015'?

thanks again

jerry

thanks for quick reply. Not sure what needs to do after reading #200 and #181. The below is the file and code: filePath.xlsx has data like '4/15/2015'; var fileContent = xlsx.readFile(filePath.xlsx); var rowDatas = xlsxUtil.sheet_to_json(fileContent.Sheets['Template']); after the above, rowDatas has '4/15/15'. Can you please provide sample codes or configs so that rowDatas can have '4/15/2015'? thanks again jerry
SheetJSDev commented 2017-04-30 16:06:00 +00:00 (Migrated from github.com)

In 0.9.13 we're adding a dateNF option for the parsers to override the interpretation of the default dates:

var fileContent = XLSX.readFile(filePath.xlsx, {dateNF:"mm/dd/yyyy"});
In 0.9.13 we're adding a `dateNF` option for the parsers to override the interpretation of the default dates: ```js var fileContent = XLSX.readFile(filePath.xlsx, {dateNF:"mm/dd/yyyy"}); ```
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#208
No description provided.