Repository navigation
Improvement for time zone handling - #798
Merged
Merged
Conversation
Resolves #797 by addressing three inconsistencies: 1. GetCreateTime() now uses NodaTime InZoneLeniently instead of manual offset arithmetic, making it the proper inverse of GetDisplayTime and handling DST transitions correctly. 2. XmlRpcManager FillEntryFromMetaWeblogPost now uses GetCreateTime (blog timezone) instead of ToUniversalTime (server OS timezone), and removes duplicate timezone conversions in metaweblog_newPost and blogger_newPost. 3. DayEntry.OccursBetween and Entry.OccursBetween/OccursBefore now properly convert UTC dates to local time before comparing, consistent with OccursInMonth. DayEntry.OccursInMonth simplified to remove manual offset adjustment that conflicted with the fixed OccursBetween. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CreateBlogPostVM was using GetUtcOffset(new Instant()) which gets the offset at Unix epoch instead of now, and offset.Seconds which returns only the seconds component (not total seconds). Replace with proper NodaTime Instant.InZone() conversion, consistent with GetDisplayTime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
PR Classification
Bug fix and improvement for time zone handling in blog post creation and filtering.
PR Summary
This PR standardizes time zone conversions using NodaTime for blog post creation and filtering logic, ensuring consistent behavior across time zones. It also adds unit tests to verify correct time zone handling.
GetCreateTimeto use NodaTime for local-to-UTC conversion.GetCreateTimeandGetDisplayTimeare inverses.