You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Opening an .xlsx turns 0 and negative date/time cells into text ("1899-12-31"), and export writes the text back #241
Found while reviewing PR #239 (#219) on a production build of b4566f9. The bug is on main before #239 too: src/lib/excelIO.ts is not touched by that PR.
What happens
A real .xlsx (written with ExcelJS) holding numbers under date/time formats, opened with Open file:
Cell
Value
Format
Excel shows
ExcelToGo shows
What the cell now holds
A1
0
dd/mm/yyyy
00/01/1900
1899-12-31
text
A2
-1
dd/mm/yyyy
########
1899-12-30
text
A3
-1.5
[h]:mm
########
1899-12-29 12:00
text
A4
1.5
[h]:mm
36:00
36:00
number (fine)
A8
=SUM(A2:A4)
[h]:mm
######## (−1)
36:00
wrong total, no warning
Because the values became text:
=A2+2 gives #VALUE! (Excel: 1).
SUM skips them in silence. A timesheet with a negative balance in [h]:mm adds up wrong.
Export writes the text back. The exported file holds the strings "1899-12-31", "1899-12-30" and "1899-12-29 12:00" where the numbers were. The data is lost on a round trip.
Values typed or computed in the app are fine after #239: a formula giving −1 under dd/mm/yyyy shows ########, and TEXT(0,"dd/mm/yyyy") is 00/01/1900. Only the import path is wrong.
Cause
ExcelJS hands a date-formatted cell over as a JS Date. rawForDate in src/lib/excelIO.ts turns that into ISO text with isoFromSerial. A serial of 0 or below becomes a year-1899 string, which dateLiteral/dateOf refuse (year < 1900), so the cell keeps the string as text. A midnight 0 under a time-only format already comes through as 00:00, and that case is fine.
Activity
Open zero and negative date/time cells as numbers (#241)
Merge pull request #242: open zero and negative date/time cells as nu…