Bugfix: DatePicker DST Offset Handling#466
Open
fhasse95 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.
While testing the DatePicker, I noticed that the selected date could shift during Daylight Saving Time (DST) transitions, resulting in an incorrect date being returned. The reason for this issue is that time zone offsets were applied manually when converting between date values and the millisecond representation used by the Android DatePicker.
To reproduce the issue, you can use the DatePickerPlayground in Skip Showcase. For example, in Germany, selecting dates around the DST transition results in the previous day being returned:
As shown in the screenshot, selecting March 30th still returns the correct value. However, selecting March 29th returns March 28th instead. The same one-day shift can also be observed for earlier dates, such as March 28th and March 27th, indicating that the timezone offset calculation causes dates before the DST transition to be shifted back by one day.
This PR removes the manual offset adjustment and uses direct timestamp conversion instead, ensuring that the selected date is preserved correctly regardless of DST or timezone offsets.
Thank you for contributing to the Skip project! Please review the contribution guide at https://skip.dev/docs/contributing/ for advice and guidance on making high-quality PRs.
Use this space to describe your change and add any labels (bug, enhancement, documentation, etc.) to help categorize your contribution.
Skip Pull Request Checklist:
swift testCodex was used to investigate and implement the fix for the DST-related DatePicker issue. After reviewing the proposed changes, I manually verified the fix by testing date selection across different dates and DST boundaries on Android.