(zoneId: string): TimeZone.NamedAttempts to create a named time zone from an IANA time zone identifier.
When to use
Use when the IANA zone id is trusted and invalid zones should throw instead
of returning Option.none or failing in Effect.
Details
If the time zone is invalid, an IllegalArgumentError will be thrown.
Example (Creating named time zones unsafely)
import { DateTime } from "effect"
const londonZone = DateTime.zoneMakeNamedUnsafe("Europe/London")
console.log(DateTime.zoneToString(londonZone)) // "Europe/London"
const tokyoZone = DateTime.zoneMakeNamedUnsafe("Asia/Tokyo")
console.log(DateTime.zoneToString(tokyoZone)) // "Asia/Tokyo"
// This would throw an IllegalArgumentError:
// DateTime.zoneMakeNamedUnsafe("Invalid/Zone")export const const zoneMakeNamedUnsafe: (
zoneId: string
) => TimeZone.Named
Attempts to create a named time zone from an IANA time zone identifier.
When to use
Use when the IANA zone id is trusted and invalid zones should throw instead
of returning Option.none or failing in Effect.
Details
If the time zone is invalid, an IllegalArgumentError will be thrown.
Example (Creating named time zones unsafely)
import { DateTime } from "effect"
const londonZone = DateTime.zoneMakeNamedUnsafe("Europe/London")
console.log(DateTime.zoneToString(londonZone)) // "Europe/London"
const tokyoZone = DateTime.zoneMakeNamedUnsafe("Asia/Tokyo")
console.log(DateTime.zoneToString(tokyoZone)) // "Asia/Tokyo"
// This would throw an IllegalArgumentError:
// DateTime.zoneMakeNamedUnsafe("Invalid/Zone")
zoneMakeNamedUnsafe: (zoneId: stringzoneId: string) => TimeZone.interface TimeZone.NamedNamed IANA time zone.
Details
The id field contains the resolved time zone identifier, such as
"Europe/London" or "America/New_York".
Named = import InternalInternal.const zoneMakeNamedUnsafe: (
zoneId: string
) => TimeZone.Named
zoneMakeNamedUnsafe