Fix fractional seconds in core property timestamps - #1608
Open
ryanchou1994 wants to merge 1 commit into
Open
Conversation
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.
Core property timestamps with fractional seconds can be read as the wrong UTC time, or as
None. For example,1997-07-16T19:20:30.45+01:00currently becomes19:20:30 UTCinstead of18:20:30.450000 UTC. A timestamp ending in.1234Zis mistaken for a numeric timezone offset and rejected.This separates the fractional seconds from the timezone before applying the existing offset conversion. It preserves UTC-aware results and the existing reduced-precision date formats. Fractional digits beyond Python's six-digit microsecond precision are truncated. The date setters are unchanged.
Regression tests read raw core-properties XML through all three date properties, covering positive and negative offsets, day/year boundaries, reduced-precision dates, and invalid input.
Validation on macOS CPython 3.13.13 and Linux CPython 3.13.15:
Full Pyright 1.1.401 still reports 7,577 existing diagnostics. A normalized comparison with the unchanged base shows no added or removed diagnostics; neither changed file has diagnostics. Word's GUI and Windows were not tested.