'Permanent daylight saving in the US, what does that mean to date.getTimezoneOffset()
I am curious to know what the result would be next year? How javascript adjusts the result behind the scene?
const date = new Date();
date.getTimezoneOffset();
Solution 1:[1]
A few things:
- Only the Senate bill (S.623) has passed. The corresponding House bill (H.R.69) still needs to pass, and then the text needs to be signed into law by the President before anything would change.
- The Senate bill has a built-in effective date of November 5, 2023 (the day DST would have ended in 2023). Presuming that carries into the final law, there is a reasonable amount of time for the required changes to be implemented, tested, and distributed.
- The process for handling such changes is already in effect, as time zone rules (including daylight saving time changes) can occur at any time from any part of the world. You won't have to do anything in particular, other than ensure you are keeping up with regular updates, which you should be doing anyway.
- Time zone data in computing is coordinated on the IANA TZ discussion list. Most companies source their time zone data from there. There are several active discussions in process about this potential change, which you can read and participate in (see March 2022 in the archives).
- The time change itself is fairly straightforward. We know from the bill how the clocks will change in the various affected time zones. The main discussion/debate is around the associated change in naming conventions.
- For example, is the west coast now forever on "PDT", or does it say "PST" and the meaning has changed. Does Arizona start using "MDT", or "PST", or does it keep saying "MST" even if that's an hour off from the rest of Mountain time. etc.
- After the change is enacted into law, IANA will release a tzdata update, which will get picked up by the various operating system, programming language platform, and software library vendors that depend on it. It will eventually make its way to the browser and other JavaScript environments.
getTimezoneOffsetwill return the correct time zone offset for the point in time reflected by theDateobject it's called on.- If you call it on
new Date(), you're asking for the current time zone offset, so it will continue to behave as it does today (returning either the standard or the daylight offset that is in effect) until November 5th, 2023. Then it will return the updated offset from then forward. - If you call it on a future date, after November 5th 2023, you will see the old (standard time) offset if your time zone data hasn't yet been updated, but you will see the new (daylight time) offset once the data has reached your environment by whatever update is applicable.
- If you call it on
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
