Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/stream/xlsx/worksheet-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class WorksheetReader extends EventEmitter {

default:
if (utils.isDateFmt(cell.numFmt)) {
cell.value = utils.excelToDate(parseFloat(c.v.text), properties.model.date1904);
cell.value = utils.excelToDate(parseFloat(c.v.text), properties.model && properties.model.date1904);
} else {
cell.value = parseFloat(c.v.text);
}
Expand Down
Binary file added spec/integration/data/dateIssue.xlsx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const ExcelJS = verquire('exceljs');
const fs = require('fs');


describe('github issues: Date field with cache style', () => {
const rows = [];
beforeEach(() =>
new Promise((resolve, reject) => {
const workbookReader = new ExcelJS.stream.xlsx.WorkbookReader(fs.createReadStream('./spec/integration/data/dateIssue.xlsx'), { worksheets: 'emit', styles: 'cache', sharedStrings: 'cache', hyperlinks: 'ignore', entries: 'ignore' });
workbookReader.read();
workbookReader.on('worksheet', worksheet => worksheet.on('row', row => rows.push(row.values[1])));
workbookReader.on('end', resolve);
workbookReader.on('error', reject);

})
);
it('issue 1328 - should emit row with Date Object', () => {
expect(rows).that.deep.equals(['Date', new Date('2020-11-20T00:00:00.000Z')]);
});
});