Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normative: Make LocalTZA take 't' and 'isUTC' and drop DSTA(t). (#778)
* Make LocalTZA take 't' and 'isUTC', Drop DSTA(t). Currently, LocalTimezoneAdjustment is assumed to be constant across time zone rule changes and does not take any argument. Daylight Savings Time Adjustment does take an argument t. DSTA(t) can 'absorb' the standard time zone offset changes (e.g. Europe/Moscow changed the standard time zone offset multiple times in the last decade.). However, the spec stipulates that it should only reprsent an additional adjustment necessary when DST is in effect. In practice, at least two implementations (Spidermonkey/Firefox and JSC/Safari) do not follow the spec to the letter to produce results expected by users across time zone rule changes. This PR revises LocalTZA to accept two arguments, 't' and 'isUTC' and drop DaylightSavingsTimeAdjustment(t). When isUTC is true, LocalTZA interprets 't' as a time value representing UTC and gives a time zone offset in effect at time t for the local time zone (for US ET, it'd be 4*msPerHour in summer and 5*msPerHour in winter). When isUTC is false, 't' is interpreted as local time value and gives a time zone offset in effect at t = t_local. It's also specified that LocalTZA(t = t_local, false) will return the offset *before* the transition when t_local is wall time repeating multiple times at a negative transition (e.g. fall backward) or skipped wall time at a positive time zone transition (e.g. spring forward). This is to get rid of an ambiguity in handling a time zone offset transition. Due to the ambiguity, different implemenations have different behaviors and some implementations have changed their behavior over the time. UTC(t) and Localtime(t) are reformulated with LocalTZA(t = t_local, false) and LocalTZA(t = t_UTC, true). Will fix #725. In the future, it might as well be considered to add an option to specify the behavior to handle skipped or repeated wall time. See [1] and [2]. [1] ICU Calendar API has skipped wall time option (https://goo.gl/h0bP26) and repeated wall time option (https://goo.gl/Q1VX3j). [2] Python proposal to handle skipped/repeated time: https://www.python.org/dev/peps/pep-0495/ * Addressed the review comments 1. Interpret skipped and repeating local time in the time zone offset before the transition. 2. s/wall time/local time/ 3. Daylight savings time => Daylight saving time.
- Loading branch information