TimeZoneSchema
const TimeZoneSchema: decodeTo<declare<TimeZone, TimeZone>, String, never, never>;Defined in: effect-v4-utils.ts:29
Effect 4 schema: validate an IANA id and brand it as TimeZone. Fails
with the message "Invalid IANA time zone". The value is not canonicalized.
It is a two-way transformation: the encoded side is a plain string, so
Schema.encodeSync gives the string back. For effect 3 use
@xtandard/lib/effect.
Example
Section titled “Example”import { Result, Schema } from "effect";import { TimeZoneSchema } from "@xtandard/lib/effect/v4";
const Settings = Schema.Struct({ timeZone: TimeZoneSchema });
Schema.decodeUnknownSync(Settings)({ timeZone: "Europe/Berlin" }); // { timeZone: "Europe/Berlin" }Result.isFailure(Schema.decodeUnknownResult(TimeZoneSchema)("Mars/Olympus")); // true