How can we find time zone abbreviation from time zone name. Is there any library which we can use to get it.
e.g.:
Input- America/Los_Angeles
Output- PDT
I tried using
usertimezone = America/Los_Angeles
print(new Date().toLocaleTimeString('en-us',{timeZone: usertimezone, timeZoneName:'short'}).split(' ')[2]);
output- PDT
But we need to provide locale. For different marketplaces locale would be different. If locale is incorrect then it provides answer based on GMT+offset.
E.g. while using time zone as "Asia/Calcutta" output is GMT+5:30. But with locale 'en-in' output is IST
Is it possible to do with plain JavaScript or a framework or library?