Skip to content

Shrink the window size for time zone transition search#79

Open
fabon-f wants to merge 1 commit intofullcalendar:mainfrom
fabon-f:window-size
Open

Shrink the window size for time zone transition search#79
fabon-f wants to merge 1 commit intofullcalendar:mainfrom
fabon-f:window-size

Conversation

@fabon-f
Copy link

@fabon-f fabon-f commented Sep 25, 2025

This pull request will fix the bug of startOfDay, getTimeZoneTransition due to too wide window size. It will also fix offset calculation bug of ZonedDateTime partially.

This is a provisional fix until "a more robust algorithm" mentioned in #73 (comment) will be introduced.

Temporal.ZonedDateTime.from("2000-10-08T03:00:00-03:00[America/Boa_Vista]").startOfDay();
// 2000-10-08T01:00:00-03:00[America/Boa_Vista], correct!

If we want to extend the window more, we have to hardcode "unusual" time zones and change the window size for each time zone ID, which isn't possible by design for now. (cf. tc39/proposal-temporal#3112)

I'm not even sure hardcoding is reasonable from the perspective of bundle size, because extending the window only affect performance of getTimeZoneTransition (which itself is API for power users and therefore rarely used) when an offset transition doesn't exist few days after or before ZonedDateTime, which is (I guess) very uncommon case. For example, startOfDay uses getTimeZoneTransition internally, but it is guaranteed that an offset transition exists in 2 days in this case, so the window size is irrelevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant