7

I was recently using momentjs but just switched to dayjs. However, I need to get a list of timezones. With momentjs it was pretty simple : moment.tz().names() , but with dayjs I can't figure out how to do it. I don't want to get 500+ timezone, rather I need I shorter, more compact list that taking account winter/summer hours changes.

Any Idea ?

2

2 Answers 2

5

Use the code below in your browser console

 for (const timeZone of Intl.supportedValuesOf('timeZone')) {console.log(timeZone)}
Sign up to request clarification or add additional context in comments.

Comments

2

You can use Intl.supportedValuesOf('timeZone'). This will return the name of the available time zones. This is not dayjs dependent. It can be used

let timezones = Intl.supportedValuesOf("timeZone");
console.log(timezones)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.