« Bugzilla Issues Index

#228 — Allow IANA time zone names in DateTimeFormat constructor

The DateTimeFormat constructor currently only allows the time zone ID "UTC" because not all implementations support the full set of time zones. We should however consider allowing those implementations that do to accept all IANA time zone names (

To specify:

- Well-formed time zone names: As far as I know, there's no formal specification of the syntax of IANA time zone names. Current usage seems to indicate /(Africa|America|Antarctica|Asia|Atlantic|Australia|Europe|Indian|Pacific)(\/[-_a-z]{1,14}){1,2}/i for canonical IDs, plus a number of deprecated IDs in the "backward" file that don't follow this pattern.

- Handling of well-formed but unrecognized time zone IDs: use host environment's current time zone, or UTC?

Support for all IANA time zones is specified in the 2013-02-28 draft. Rather than trying to defined well-formedness for the IANA time zone names, we simply accept as valid the actual names defined in the database, and throw exceptions for anything else.