-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle timezones with no transitions properly #6478
fix: handle timezones with no transitions properly #6478
Conversation
Signed-off-by: SebastianKrupinski <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6478 +/- ##
============================================
+ Coverage 23.47% 23.48% +0.01%
- Complexity 453 454 +1
============================================
Files 247 247
Lines 11712 11711 -1
Branches 2222 2223 +1
============================================
+ Hits 2749 2750 +1
+ Misses 8643 8641 -2
Partials 320 320
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Can you elaborate why skipping the first (or 0 position) solves the issue please? 🙏 |
Morning, sure, This code actually process the first position, instead of skipping it, the original code, skipped transition 0, which in certain time zones is needed for time zones with static transitions. Here is a example of how Mexico City time zone was being generated: Before:
After:
The Mexico City timezone has a single static transition which was being skipped originally, and because the "BEGIN:STANDARD" was missing the timezone was never applied to the event, showing the event off by the amount of the timezone offset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works.
$offset = $trans['offset'] / 3600; | ||
|
||
if ($i === 0) { | ||
$date = new \DateTime('19700101T000000'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a bit weird to use 1970-01-01
here.
Using $trans['time']
would also work but it can stay as is. It will be equivalent to the requested start date (one year back).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know it looks odd, but this is how all the other software I have tested handles this, so I thought it would be best stay with the follow. The start year an date does not really matter for static time zones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!
/backport to stable4.7 |
/backport to stable5.0 |
Resolves: #6476
Testing: See issue ticket for details.