catamphetamine / read-excel-file

Read *.xlsx files in a browser or Node.js. Parse to JSON with a strict schema.
https://catamphetamine.gitlab.io/read-excel-file/
MIT License
301 stars 52 forks source link

Date format not being picked up #89

Closed burhan85 closed 4 years ago

burhan85 commented 4 years ago

I am trying to parse an excel sheet with schema option and have specified a rule for a property as 'Suggested Financing Period': { prop: 'SuggestedPeriod', type: Date, dateFormat: "DD/MM/YYYY", required: true } but this property is not being handled as per the specified date format. Instead, the value is being treated as an invalid date value because it's still being picked up in "MM/DD/YYYY" format.

catamphetamine commented 4 years ago

I've corrected the readme:

readXlsxFile(file, { schema: ..., dateFormat: 'DD/MM/YYYY' })
burhan85 commented 4 years ago

I tried this but it's still not working.

catamphetamine commented 4 years ago

The test case seems to work. https://github.com/catamphetamine/read-excel-file/blob/8fbcf33c4c5e850c471498303ea2b49cfeb9a73a/test/1904.test.js#L5-L7

You can investigate the issue yourself then.