0

Given any timezone, like America/New_York, how can I figure out in JavaScript if DST (Daylight Savings Time) is in effect? I'm looking for a solution that does not use any big libraries like moment. Using smaller, more specific libraries like tz-offset is fine.

applemavs
  • 503
  • 3
  • 9
  • 22
  • https://stackoverflow.com/questions/11887934/how-to-check-if-dst-daylight-saving-time-is-in-effect-and-if-so-the-offset – Nathan Dawson Mar 23 '21 at 21:06
  • 1
    That question addresses checking if DST is in effect within the local timezone. I’m trying to find out if DST is in effect given any timezone. – applemavs Mar 23 '21 at 21:21
  • 1
    tz-offset library doesn't handle DST correctly, but [Luxon](https://moment.github.io/luxon/) and [Date-fns-tz](https://github.com/marnusw/date-fns-tz) do. Both are relatively small and support tree-shaking. You could also adapt the approach [here](https://stackoverflow.com/a/36146278/634824) with the one in the link Nathan gave. – Matt Johnson-Pint Mar 23 '21 at 21:50

0 Answers0