nextcloud / calendar

📆 Calendar app for Nextcloud
https://apps.nextcloud.com/apps/calendar
GNU Affero General Public License v3.0
985 stars 239 forks source link

fix: handle timezones with no transitions properly #6478

Closed SebastianKrupinski closed 1 week ago

SebastianKrupinski commented 2 weeks ago

Resolves: https://github.com/nextcloud/calendar/issues/6476

Testing: See issue ticket for details.

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 23.48%. Comparing base (9d1688c) to head (991402f). Report is 30 commits behind head on main.

Additional details and impacted files ```diff @@ 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 ``` | [Flag](https://app.codecov.io/gh/nextcloud/calendar/pull/6478/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nextcloud) | Coverage Δ | | |---|---|---| | [javascript](https://app.codecov.io/gh/nextcloud/calendar/pull/6478/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nextcloud) | `15.05% <ø> (-0.01%)` | :arrow_down: | | [php](https://app.codecov.io/gh/nextcloud/calendar/pull/6478/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nextcloud) | `59.44% <ø> (+0.12%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nextcloud#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

miaulalala commented 1 week ago

Can you elaborate why skipping the first (or 0 position) solves the issue please? :pray:

SebastianKrupinski commented 1 week ago

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:

BEGIN:VTIMEZONE
TZID:America/Mexico_City
X-MICROSOFT-CDO-TZID:37
END:VTIMEZONE

After:

BEGIN:VTIMEZONE
TZID:America/Mexico_City
X-MICROSOFT-CDO-TZID:37

BEGIN:STANDARD
TZOFFSETFROM:-0600
TZOFFSETTO:-0600
TZNAME:CST
DTSTART:19700101T000000
END:STANDARD

END:VTIMEZONE

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.

SebastianKrupinski commented 1 week ago

/backport to stable4.7

st3iny commented 1 week ago

/backport to stable5.0