I cannot find any function to get the timezone as string in typescript, like 'Europe/Berlin'
The Date class can just show me the timezoneOffset
I cannot find any function to get the timezone as string in typescript, like 'Europe/Berlin'
The Date class can just show me the timezoneOffset
Moment js and moment-timezone are in maintenance mode. it support most of Browser. It's not dead so you can still use it.
However it has some limitation like Tree shaking - reduce build size by import function as per need.
Luxon js - enhanced version of moment.js which have tree shaking and other advantages.
DateTime.local().zoneName;
Output: America/Chicago
You can still use moment-timezone as mention here. https://momentjs.com/timezone/
Below method will give you clients timezone in the format you needs.
moment.tz.guess();
Output: America/Chicago
Here is an other alternative way similar to moment js.
https://momentjs.com/docs/#/-project-status/recommendations/