Normalize datetime values to UTC in blog plugin#7708
Merged
squidfunk merged 2 commits intosquidfunk:masterfrom Nov 19, 2024
Merged
Normalize datetime values to UTC in blog plugin#7708squidfunk merged 2 commits intosquidfunk:masterfrom
squidfunk merged 2 commits intosquidfunk:masterfrom
Conversation
Fixes squidfunk#7705 Normalize datetime values to UTC in blog plugin to handle offset-naive and offset-aware datetimes correctly. * Import `timezone` from `datetime` in `material/plugins/blog/structure/options.py`. * Modify `pre_validation` method to set `tzinfo=timezone.utc` for datetime values. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/squidfunk/mkdocs-material/issues/7705?shareId=XXXX-XXXX-XXXX-XXXX).
Contributor
|
FWIW, in MkDocs itself, a similar issue with timezones mkdocs/mkdocs#3794 was resolved in roughly the same way mkdocs/mkdocs#3795 several months ago. |
Owner
|
Thanks for the PR, and @vedranmiletic for linking the related issue. Looks sensible! |
Owner
|
Ah, one problem: please make the changes in the Warning Never make any changes in the |
Fixes squidfunk#7705 + Move changes to src directory
Contributor
Author
|
Ah! I'd forgotten since last time. I've updated the PR to only modify the |
Owner
|
Thanks! |
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.
Fixes #7705
Normalize datetime values to UTC in blog plugin to make the datetime object offset-aware.
timezonefromdatetimeinmaterial/plugins/blog/structure/options.py.pre_validationmethod to settzinfo=timezone.utcfor datetime values.For more details, open the Copilot Workspace session.