-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a timezonechange event to Window/WorkerGlobalScope
The current timezone is visible to JavaScript and changes over time. Changes may be useful to note, e.g., in a long-running calendar or mail application that may want to update dates and times without refreshing when the user resumes using the application after travel. Currently, to accomplish that, a webapp would have to poll, e.g., by repeatedly calling `Intl.DateTimeFormat().resolvedOptions().timeZone`. With this patch, an event would instead notify the application. In this patch, the event has to run to completion before the new time zone is visible to JavaScript. These semantics are taken to give users the most consistency and ensure that UIs don't get in inconsistent states with parts rendered wtih one timezone and parts with another. This choice for consistency might be a relatively large burden for implementations and may need to be revised. Some JavaScript implementations do timezone calculations for Date by using OS APIs. These OS APIs are always operating on the current timezone. To implement the semantics that the new timezone does not take effect until the event handler starts running, it would be necessary for these implementations to use an alternate library for timezone calculations. Several such libraries exist.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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