Skip to content

DateTimeZone does not return canonical timezone names for legacy/alias identifiers #5020

@bedwal-deepak

Description

@bedwal-deepak

From manual page: https://php.net/datetimezone.listidentifiers


The DateTimeZone class in PHP is not returning canonical timezone names when using valid alias/legacy identifiers such as:

  • US/Eastern (expected: America/New_York)
  • US/Central (expected: America/Chicago)
  • Canada/Eastern (expected: America/Toronto)
  • US/Pacific (expected: America/Los_Angeles)
  • US/Hawaii (expected: Pacific/Honolulu)
  • Etc/GMT (expected: Etc/GMT but validation fails in DateTimeZone::listIdentifiers())

These timezones are accepted by new DateTimeZone(), but:

  • They do not appear in DateTimeZone::listIdentifiers(), causing validation rules to fail.
  • DateTimeZone::getName() and DateTime::format('e') return the same alias instead of the canonical name.

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