I'd like to be able to tell if a user is in Canada and show an English-French language toggle for those users. So I've decided to use the Intl.DateTimeformat.resolvedOptions
approach. It's pretty straightforward, if the user's system is says it's in a Canadian time-zone, then I want to respect that and assume they want to see this Canadian option. You can see a working demo below:
const obj = Intl.DateTimeFormat().resolvedOptions();
console.log("Locale: ", obj.locale);
console.log("TimeZone: ", obj.timeZone);
I've asked some friends to test it, and so far I've got 2 timeZones
America/Toronto
America/Vancouver
but I need to cover all the Canadian options. I've looked at the ECMA internationalization API and IANA TimeZone Database but I cannot find what I'm looking for because their documentation is too vast. What are all the possible Canadian timezones that I could get from this specification?