You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] Built-in timeZone data type #1100
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{newIntl.DateTimeFormat("en",{timeZone: val});}catch{thrownewValidationError(`"${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
pullfrog commentedon Sep 18, 2026
theoephraim commentedon Sep 18, 2026
@aek676 - I can just add it, but feel free to open the PR if you want to! ill wait a bit :)
aek676 commentedon Sep 21, 2026
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.