Skip to content

fix: read an ods duration of one to fifty-nine days on the day LibreOffice shows, not a day later - #193

Merged
vaceslav merged 1 commit into
mainfrom
fix/ods-duration-days-from-null-date
Nov 17, 2026
Merged

vaceslav merged 1 commit into
mainfrom
fix/ods-duration-days-from-null-date

Conversation

@vaceslav

Copy link
Copy Markdown
Contributor

An ods time cell holds an ISO 8601 duration counted from LibreOffice's null date, 30 December 1899. LibreOffice writes a date-time as such a duration when the cell has a time-only format. The reader counted durations of one to fifty-nine days from 31 December, the base an xlsx 1900-system serial below 60 needs because Excel invents a 29 February 1900. LibreOffice's calendar has no such day, so those cells, the dates of January and February 1900, read one day later than LibreOffice shows them. Noticed while fixing serial 60 for #184.

What changes:

  • A duration of a day or more counts from 30 December 1899 throughout: one day is 31 December 1899, two days 1 January 1900, sixty days 28 February 1900, as LibreOffice shows them.
  • A duration under a day still reads as a time of day on 31 December 1899, the day an xlsx time-only cell reads on, so a time column reads alike from either format.
  • A spreadsheet that states another null date still counts every duration from that day.
  • XlsxCursor.TryFromWorkbookDays, added in fix: read Excel's phantom 29 February 1900 as no date, a cell without a style as style 0, and character references of any length #189 for the ods path only, is gone. TryFromSerial again picks its own base, and the 30 December date is the shared XlsxCursor.LibreOfficeNullDate.

The one visible cost: a duration just under a day reads later than one of exactly a day. No date-time of LibreOffice's falls there, and this is noted in the remarks. Before the change the same jump sat at sixty days.

Tests: a new theory pins 23:59:59, one day, 1½ days, 2, 59, 60 and 61 days. ReadsATimeWithMoreFractionalDigitsThanATimeSpanHolds (1,234 hours, about 51 days) now expects the day LibreOffice shows. docs/formats.md describes the rule.

@vaceslav vaceslav closed this Nov 17, 2026
@vaceslav
vaceslav deleted the fix/ods-duration-days-from-null-date branch November 17, 2026 19:45
@vaceslav
vaceslav restored the fix/ods-duration-days-from-null-date branch November 17, 2026 19:46
@vaceslav vaceslav reopened this Nov 17, 2026
@vaceslav
vaceslav merged commit a7145d3 into main Nov 17, 2026
38 of 47 checks passed
@vaceslav
vaceslav deleted the fix/ods-duration-days-from-null-date branch November 17, 2026 19:52
vaceslav added a commit that referenced this pull request Nov 18, 2026
🤖 I have created a release *beep* *boop*
---


## [0.8.3](v0.8.2...v0.8.3)
(2026-11-17)


### Bug Fixes

* count dates written with a multi-character date separator as the
culture's own ([#186](#186))
([fc8b11f](fc8b11f))
* count each ods sheet's repeats once against MaxRepeatedCells, so
reading a sheet again is not refused
([#187](#187))
([b450d4a](b450d4a))
* locate a workbook cell that does not fit a reading among its outliers
([#194](#194))
([7ebcfbc](7ebcfbc))
* read an ods duration of one to fifty-nine days on the day LibreOffice
shows, not a day later
([#193](#193))
([a7145d3](a7145d3))
* read Excel's phantom 29 February 1900 as no date, a cell without a
style as style 0, and character references of any length
([#189](#189))
([e4008fa](e4008fa))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Slava <vaceslav@users.noreply.github.com>
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