Skip to content

bug fix can not read property date1904 of undefined #1328

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

Merged
merged 2 commits into from
Jun 28, 2020
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')]);
});
});
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy