-
After creating a date with a set timezone, I am trying to determine if the timezone supports daylights savings time or has a constant offset year round. I was under the impression from the documentation I could use What's the best way to check if a time zones offset changes throughout the year? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Unfortunately, the only way is to probe some dates and see if they have different offsets. Luxon users a similar trick to implement Luxon doesn't actually have access to the time zone rules, so it doesn't have a way to tell you that from the zone itself. |
Beta Was this translation helpful? Give feedback.
-
@icambron Thank you for the info. I might be able to do something similar for my use case. It would be nice if Intl API would eventually support labeling which time zones support DST, and if you could equally get the start and end dates. Do you happen know if there is a way to make Intl API suggestions? |
Beta Was this translation helpful? Give feedback.
Unfortunately, the only way is to probe some dates and see if they have different offsets. Luxon users a similar trick to implement
isInDST()
Luxon doesn't actually have access to the time zone rules, so it doesn't have a way to tell you that from the zone itself.
isUniversal
, as you saw, can only know if it can't have a DST because the zone declares itself that way, so it works with fixed-offset zones that Luxon supports directly. For an IANA-specified zone, it might or might not have a DST, and Luxon will get the times right regardless, but it's unaware of the DST as a standalone fact.