GitHub 6521★

Get the timezone string

JavaScript version

const getTimezone = () => Intl.DateTimeFormat().resolvedOptions().timeZone;

TypeScript version

const getTimezone = (): string => Intl.DateTimeFormat().resolvedOptions().timeZone;

Example

getTimezone(); // 'Asia/Saigon'
Follow me on and to get more useful contents.