Fix tracking date selection for all timezones#3129
Open
leodyversemilla07 wants to merge 1 commit intomihonapp:mainfrom
Open
Fix tracking date selection for all timezones#3129leodyversemilla07 wants to merge 1 commit intomihonapp:mainfrom
leodyversemilla07 wants to merge 1 commit intomihonapp:mainfrom
Conversation
Fixes date validation issues in positive timezones while maintaining the fix for negative timezones from PR mihonapp#2617. The issue was that stored dates (in system local timezone) were being compared directly as UTC timestamps without timezone conversion. This caused incorrect date comparisons: - In GMT+2: March 24 00:00 local = March 23 22:00 UTC But code treated it as March 24 00:00 UTC (wrong!) - In GMT-5: March 24 00:00 local = March 24 05:00 UTC Code treated it as March 24 00:00 UTC (happened to work) The fix properly converts stored dates from system timezone to UTC before comparison, ensuring correct behavior across all timezones. Fixes mihonapp#3126
6d3e998 to
cbd7812
Compare
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.
Summary
Properly converts stored dates from system timezone to UTC before comparison to fix date validation issues in positive timezones while maintaining the fix for negative timezones from PR #2617.
Issue
Fixes #3126
Root Cause
The previous fix (PR #2617) resolved date selection issues for negative timezones but inadvertently broke positive timezones.
Stored dates are in system local timezone, but the comparison logic was treating them as UTC timestamps without proper conversion:
In positive timezones (GMT+2):
In negative timezones (GMT-5):
Solution
Apply the same timezone conversion used for
initialSelection(line 538) to the date comparison logic. This ensures stored dates are properly converted from system timezone to UTC before comparing with the picker's UTC timestamps.Changed lines:
track.finishDatefrom system timezone to UTCtrack.startDatefrom system timezone to UTCtrack.finishDatefrom system timezone to UTCtrack.startDatefrom system timezone to UTCTesting
Manual testing recommended for both positive and negative timezones:
Self-review