Skip to content

Convert timezone-aware core properties to UTC - #1651

Open
Grivn wants to merge 1 commit into
python-openxml:masterfrom
Grivn:fix/core-property-timezones
Open

Grivn wants to merge 1 commit into
python-openxml:masterfrom
Grivn:fix/core-property-timezones

Conversation

@Grivn

@Grivn Grivn commented Nov 29, 2026

Copy link
Copy Markdown

Setting a core property to 2024-01-01 01:15+08:00 currently writes 2024-01-01T01:15:00Z to docProps/core.xml. Reopening the document moves the timestamp forward eight hours.

Convert aware datetimes to UTC before writing created, modified, and last_printed. The example now round-trips as 2023-12-31T17:15:00Z. Naive datetimes keep their existing UTC interpretation. This addresses the timezone-aware input in #1542.

Added regression cases for positive and negative offsets that cross midnight. The unit and acceptance suites passed on Python 3.9 through 3.13. I also saved and reopened documents with all three properties set, including both occurrences of the repeated hour when daylight saving time ends.

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