Skip to content

Intl.DateTimeFormat - "Pacific/Kanton" is invalid time zone #42980

Description

@smith-xyz

Version

v16.13.2

Platform

21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64

Subsystem

No response

What steps will reproduce the bug?

When providing Pacific/Kanton as a timezone to Intl, it is returned as invalid:

try {
  new Intl.DateTimeFormat("en-US", {
    timeZone: "Pacific/Kanton",
  });
} catch (err) {
  console.error(err);
}

How often does it reproduce? Is there a required condition?

Seems to consistently throw an error

What is the expected behavior?

Should be considered a valid time zone since IANA lists it as an active time zone.

What do you see instead?

An error is thrown for an invalid time zone provided:

RangeError: Invalid time zone specified: Pacific/Kanton
    at new DateTimeFormat (<anonymous>)
    at Object.<anonymous> (/Code/ssmith-sandbox/dist/index.js:3:5)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Additional information

I may just be missing something in regards to why this tz is invalid, but found this interesting when I stumbled on it recently. Would gladly like to know!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions