how to get current user time zone ?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I want to get the current user time zone automatically in my table.


Is there any api or way to fetch the current time zone of the logged in user?

Photo of Geetanjali

Geetanjali

  • 42 Points

Posted 3 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
With script you can use Date().getTimezoneOffset() but this will not reflect daylight savings time and perhaps some other edge cases. For that you need a library such as jsTimezone:

jsTimezone
http://joshowens.me/dealing-with-timezones-in-javascript/