(zone: string): Option.Option<TimeZone>Tries to parse a TimeZone from a string safely.
Details
Supports both IANA time zone identifiers and offset formats like "+03:00".
Example (Parsing time zones)
import { DateTime } from "effect"
const namedZone = DateTime.zoneFromString("Europe/London")
const offsetZone = DateTime.zoneFromString("+03:00")
const invalid = DateTime.zoneFromString("invalid")
console.log(namedZone._tag === "Some") // true
console.log(offsetZone._tag === "Some") // true
console.log(invalid._tag === "None") // trueexport const const zoneFromString: (
zone: string
) => Option.Option<TimeZone>
Tries to parse a TimeZone from a string safely.
Details
Supports both IANA time zone identifiers and offset formats like "+03:00".
Example (Parsing time zones)
import { DateTime } from "effect"
const namedZone = DateTime.zoneFromString("Europe/London")
const offsetZone = DateTime.zoneFromString("+03:00")
const invalid = DateTime.zoneFromString("invalid")
console.log(namedZone._tag === "Some") // true
console.log(offsetZone._tag === "Some") // true
console.log(invalid._tag === "None") // true
zoneFromString: (zone: stringzone: string) => import OptionOption.type Option<A> = Option.None<A> | Option.Some<A>The Option data type represents optional values. An Option<A> is either
Some<A>, containing a value of type A, or None, representing absence.
When to use
Use to represent initial values that may not yet exist
- Returning from partial functions (not defined for all inputs)
- Managing optional fields in data structures
Namespace containing utility types for Option.
When to use
Use to access type-level helpers associated with Option.
Option<type TimeZone = TimeZone.Offset | TimeZone.NamedRepresents a time zone used by DateTime.Zoned.
Details
A TimeZone is either a fixed offset from UTC or a named IANA time zone.
Companion namespace containing the public variant and protocol types for
TimeZone.
TimeZone> = import InternalInternal.const zoneFromString: (
zone: string
) => Option.Option<DateTime.TimeZone>
zoneFromString