Repository navigation
Open zero and negative date/time cells as numbers (#241) - #242
Merged
Merged
Conversation
ExcelJS hands a date-formatted cell over as a Date, and rawForDate wrote it as ISO text. A serial of 0 or below became a year-1899 day that no date reading accepts, so the cell turned into text: SUM skipped it, =A2+2 gave #VALUE!, and export wrote the text over the number in the file. rawForDate now keeps such a serial as the number. Its format came in as before, so the grid shows it as #219 does (00/01/1900, ########) and export writes the number back with its format. Midnight under a time-only format still opens as 00:00. Three tests in excelIO.test.ts on a real .xlsx (import, a formula reading the cells, export), all red on the old excelIO.ts. Built on #59's head; recounted to 2017 tests, picture 27 retaken in both languages and the social card rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013pmWZsbmugfpqtYazrzfjj
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
PO review: merged at
This was the last Generated by Claude Code |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Closes #241.
The bug: ExcelJS hands a date-formatted cell over as a JS
Date, andrawForDateinsrc/lib/excelIO.tsturned it into ISO text withisoFromSerial. For a serial of 0 or below, that text is a year-1899 day (1899-12-31,1899-12-30,1899-12-29 12:00).dateLiteralrefuses any year before 1900, so the cell kept the string as text. As a result:SUMskipped those cells without a word;=A2+2gave#VALUE!;The fix:
rawForDatekeeps a serial below 0, or a 0 that is not midnight under a time-only format, as the number itself. The cell's format comes in exactly as before, so the grid shows it the way #219 does:00/01/1900for 0, and########for a negative. Export writes the number back with its format. Midnight under a time-only format still opens as00:00, the case the issue notes is already fine.Reproduced on
mainfirstThe issue's file: A1
0(dd/mm/yyyy), A2-1(dd/mm/yyyy), A3-1.5([h]:mm), A41.5([h]:mm), A545366(dd/mm/yyyy), B2=A2+2, A8=SUM(A2:A4)([h]:mm).main1899-12-31,1899-12-30,1899-12-29 12:00(text)0,-1,-1.5(numbers)00/01/1900/########/########=A2+2#VALUE!1=SUM(A2:A4)36:00, i.e. 1.5 (A2 and A3 skipped), per the issue-1dd/mm/yyyy/[h]:mm1.5and A54536636:00,15/03/2024How it was verified
npm run verify(all ten gates): all ten gates green on5c1136b. The current head8cc1b64carries that tree unchanged; it only adds the merge ofmain726af92(Point each exported chart series at its own column (#59) #240).excelIO.test.ts(+3), on a real.xlsxwritten with ExcelJS in the issue's layout:=A2+2is1and theSUMis-1;main'sexcelIO.ts, all three fail. The first finds1899-12-31and1899-12-30where the numbers should be, and the second gets#VALUE!for=A2+2..xlsx, but I did not open the file in the app.excelIO.test.tsrow (58 → 61).The branch
This is the session's branch
claude/new-session-m6mehm. The work was written on a local branch on top of #59's head6f54079, so the counts already included #59's test, withmain726af92(#240) merged in.🤖 Generated with Claude Code
https://claude.ai/code/session_013pmWZsbmugfpqtYazrzfjj
Generated by Claude Code