Skip to content

[Feature Request] Built-in timeZone data type #1100

Open

Description

@aek676

Description

A built-in @type=timeZone data type that validates IANA time zone names (Europe/Madrid, UTC, America/Argentina/Buenos_Aires).

Motivation

A regex can only check the shape of the value, so the realistic mistake, a typo like Europe/Madird, passes validation and blows up later at runtime with a RangeError, far from the config that caused it. The runtime already knows the real list of zones, so the schema could check against it at load time.

Proposed Solution

Validate with Intl, which behaves the same under Node and Bun:

validate(val) {
 try {
  new Intl.DateTimeFormat("en", { timeZone: val });
 } catch {
  throw new ValidationError(`"${val}" is not a known IANA time zone`);
 }
}
# @type=timeZone
SALON_TIME_ZONE=Europe/Madrid

It's about 10 lines, which is why it feels like it belongs next to url, email, port and the other built-in types. Happy to send a PR if you'd take it.

Activity

  1. pullfrog commented on Sep 18, 2026

    @pullfrog
    Contributor
  2. theoephraim commented on Sep 18, 2026

    @theoephraim
    Member

    @aek676 - I can just add it, but feel free to open the PR if you want to! ill wait a bit :)

  3. aek676 commented on Sep 21, 2026

    @aek676
    Author

    @aek676 - I can just add it, but feel free to open the PR if you want to! ill wait a bit :)

    I want to do it on my own. I would like to collaborate on this great project.
    When I have a moment, I'll do it.

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