Skip to content

Is there a way to get canonical/correct casing for IANA timezone names in Luxon? #1717

@ThatSameer

Description

@ThatSameer

Is your feature request related to a problem? Please describe.
I’m using Luxon to validate user-provided IANA timezone strings. Luxon’s DateTime.setZone() method correctly validates timezones case-insensitively, but it preserves the input casing when accessing zoneName.
For example, if given america/nEw_york, zoneName returns america/nEw_york instead of the canonical America/New_York.

I would've expected using toFormat('z') to return the correctly cased IANA timezone but it still returns the incorrectly cased user inputted timezone.

From what I can see, Luxon doesn't support normalise or canonicalise IANA timezone names with correct casing... unless it's me doing something wrong?

Describe the solution you'd like
To be able to normalise/canonicalise IANA timezones with correct casing

Describe alternatives you've considered
Manually correct casing comparing to IANA timezone database

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions