Skip to content

Fix the return value from dateToExcel() when it's passed a non-numeric value.#2956

Open
davepuchyr wants to merge 1 commit intoexceljs:masterfrom
davepuchyr:fix-excelToDate
Open

Fix the return value from dateToExcel() when it's passed a non-numeric value.#2956
davepuchyr wants to merge 1 commit intoexceljs:masterfrom
davepuchyr:fix-excelToDate

Conversation

@davepuchyr
Copy link
Copy Markdown

If a non-numeric value is passed to dateToExcel(), like when it's called because the cell style is a date format, the result is "Invalid Date", which gets converted to NaN when the sheet is persisted, which causes Excel to pop-up extremely annoying warnings the next time that the sheet is opened. This 1-liner fixes that.

damage

privatecoder added a commit to privatecoder/exceljs that referenced this pull request Sep 24, 2025
protobi-pieter added a commit to protobi/exceljs that referenced this pull request Nov 7, 2025
Adopts 5 low-complexity bug fixes from upstream exceljs/exceljs to improve
robustness and fix data corruption issues.

Changes:

1. exceljs#2851 - Fix boolean XML attribute parsing (Issue #18)
   - lib/xlsx/xform/simple/boolean-xform.js
   - Correctly handles <strike val="0"/> and other boolean attributes
   - Respects val attribute instead of always returning true

2. exceljs#2956 - Fix excelToDate() for non-numeric values (Issue #19)
   - lib/utils/utils.js
   - Prevents "Invalid Date" errors when cell has date format but non-numeric value
   - Eliminates Excel warnings on file open

3. exceljs#2973 - Fix dynamicFilter parsing in tables (Issue #20)
   - lib/xlsx/xform/table/filter-column-xform.js
   - Prevents exception when loading files with dynamic table filters
   - Ignores unsupported dynamicFilter nodes gracefully

4. exceljs#2915 - Fix WorkbookReader sharedString resolution (Issue #21)
   - lib/stream/xlsx/workbook-reader.js
   - Fixes data corruption where sharedString indices shown instead of actual values
   - Corrects stream piping for proper sharedString resolution

5. exceljs#2978 - Fix undefined column autofilter assignment (Issue #22)
   - lib/xlsx/xform/table/table-xform.js
   - Prevents crashes when autofilter references non-existent columns
   - Adds guard clause for missing column indices

All changes are low-risk, single-file modifications that fix real user-reported bugs.

Upstream PRs:
- exceljs#2851
- exceljs#2956
- exceljs#2973
- exceljs#2915
- exceljs#2978

Tests: All existing tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Jason233Wang <[email protected]>
Co-Authored-By: davepuchyr <[email protected]>
Co-Authored-By: Johnny Oshika <[email protected]>
Co-Authored-By: Anecha Kuekharem <[email protected]>
Co-Authored-By: Niels Abildgaard <[email protected]>
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

Successfully merging this pull request may close these issues.

1 participant