TimeZoneType-level representation of TimeZone.
export interface TimeZone extends interface declare<T, Iso = T>Creates a schema for a non-parametric opaque type using a type-guard
function. The schema accepts any unknown value and succeeds when is returns
true, failing with an InvalidType issue otherwise.
When to use
Use when you are defining a schema for an opaque type with no type parameters
and validation can be expressed as a type guard.
Example (Defining a schema for a custom UserId branded type)
import { Schema } from "effect"
type UserId = string & { readonly _tag: "UserId" }
const isUserId = (u: unknown): u is UserId =>
typeof u === "string" && u.startsWith("user_")
const UserId = Schema.declare<UserId>(isUserId, {
title: "UserId",
description: "A user identifier starting with 'user_'"
})
Type-level representation returned by
declare
.
declare<import DateTimeDateTime.type DateTime.TimeZone = /*unresolved*/ anyTimeZone> {
readonly "Rebuild": TimeZone
}
const const TimeZoneString: Stringconst TimeZoneString: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<string, readonly []>) => String;
annotateKey: (annotations: Annotations.Key<string>) => String;
check: (checks_0: SchemaAST.Check<string>, ...checks: Array<SchemaAST.Check<string>>) => String;
rebuild: (ast: SchemaAST.String) => String;
make: (input: string, options?: MakeOptions) => string;
makeOption: (input: string, options?: MakeOptions) => Option_.Option<string>;
makeEffect: (input: string, options?: MakeOptions) => Effect.Effect<string, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
TimeZoneString = const String: Stringconst String: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<string, readonly []>) => String;
annotateKey: (annotations: Annotations.Key<string>) => String;
check: (checks_0: SchemaAST.Check<string>, ...checks: Array<SchemaAST.Check<string>>) => String;
rebuild: (ast: SchemaAST.String) => String;
make: (input: string, options?: MakeOptions) => string;
makeOption: (input: string, options?: MakeOptions) => Option_.Option<string>;
makeEffect: (input: string, options?: MakeOptions) => Effect.Effect<string, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
String
.
Schema for string values. Validates that the input is typeof "string".
String.Bottom<string, string, never, never, String, String, string, string, readonly [], string, "readonly", "required", "no-default", "readonly", "required">.annotate(annotations: Annotations.Bottom<string, readonly []>): Stringannotate({
Annotations.Augment.expected?: string | undefinedHuman-readable description of what a value is expected to satisfy.
Details
For filter and refinement failures, the default formatter uses
message first, then expected, and finally falls back to <filter>.
Use this to name a failed filter in the default message:
Expected <expected>, got <actual>.
expected: "a time zone string (IANA identifier or offset like +03:00)"
})
/**
* Schema for `DateTime.TimeZone` values.
*
* **Details**
*
* Default JSON serializer:
*
* - encodes `DateTime.TimeZone` as a string (IANA identifier or offset like
* `+03:00`)
*
* @category DateTime
* @since 3.10.0
*/
export const const TimeZone: TimeZoneconst TimeZone: {
Rebuild: TimeZone;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<DateTime.TimeZone, readonly []>) => TimeZone;
annotateKey: (annotations: Annotations.Key<DateTime.TimeZone>) => TimeZone;
check: (checks_0: SchemaAST.Check<DateTime.TimeZone>, ...checks: Array<SchemaAST.Check<DateTime.TimeZone>>) => TimeZone;
rebuild: (ast: SchemaAST.Declaration) => TimeZone;
make: (input: DateTime.TimeZone, options?: MakeOptions) => DateTime.TimeZone;
makeOption: (input: DateTime.TimeZone, options?: MakeOptions) => Option_.Option<DateTime.TimeZone>;
makeEffect: (input: DateTime.TimeZone, options?: MakeOptions) => Effect.Effect<DateTime.TimeZone, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
TimeZone
.
Schema for DateTime.TimeZone values.
Details
Default JSON serializer:
- encodes
DateTime.TimeZone as a string (IANA identifier or offset like
+03:00)
TimeZone: TimeZone = function declare<T, Iso = T>(
is: (u: unknown) => u is T,
annotations?:
| Annotations.Declaration<T>
| undefined
): declare<T, Iso>
Creates a schema for a non-parametric opaque type using a type-guard
function. The schema accepts any unknown value and succeeds when is returns
true, failing with an InvalidType issue otherwise.
When to use
Use when you are defining a schema for an opaque type with no type parameters
and validation can be expressed as a type guard.
Example (Defining a schema for a custom UserId branded type)
import { Schema } from "effect"
type UserId = string & { readonly _tag: "UserId" }
const isUserId = (u: unknown): u is UserId =>
typeof u === "string" && u.startsWith("user_")
const UserId = Schema.declare<UserId>(isUserId, {
title: "UserId",
description: "A user identifier starting with 'user_'"
})
declare(
import DateTimeDateTime.isTimeZone,
{
Annotations.Declaration<DateTime.TimeZone, readonly []>.typeConstructor?: {
readonly [key: string]: unknown;
readonly _tag: string;
} | undefined
typeConstructor: {
_tag: string_tag: "effect/DateTime.TimeZone"
},
Annotations.Declaration<DateTime.TimeZone, readonly []>.generation?: {
readonly runtime: string;
readonly Type: string;
readonly Encoded?: string | undefined;
readonly importDeclaration?: string | undefined;
} | undefined
generation: {
runtime: stringruntime: `Schema.TimeZone`,
type Type: stringType: `DateTime.TimeZone`,
importDeclaration?: string | undefinedimportDeclaration: `import * as DateTime from "effect/DateTime"`
},
Annotations.Augment.expected?: string | undefinedHuman-readable description of what a value is expected to satisfy.
Details
For filter and refinement failures, the default formatter uses
message first, then expected, and finally falls back to <filter>.
Use this to name a failed filter in the default message:
Expected <expected>, got <actual>.
expected: "DateTime.TimeZone",
Annotations.Declaration<DateTime.TimeZone, readonly []>.toCodecJson?: ((typeParameters: readonly []) => SchemaAST.Link) | undefinedtoCodecJson: () =>
function link<T>(): <
To extends Constraint
>(
encodeTo: To,
transformation: {
readonly decode: SchemaGetter.Getter<
T,
NoInfer<To["Type"]>
>
readonly encode: SchemaGetter.Getter<
NoInfer<To["Type"]>,
T
>
}
) => SchemaAST.Link
Constructs an SchemaAST.Link that describes how a value of type T encodes to and decodes from a To schema.
Used when building low-level AST transformations that bridge two schema types.
link<import DateTimeDateTime.type DateTime.TimeZone = /*unresolved*/ anyTimeZone>()(
const TimeZoneString: Stringconst TimeZoneString: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<string, readonly []>) => String;
annotateKey: (annotations: Annotations.Key<string>) => String;
check: (checks_0: SchemaAST.Check<string>, ...checks: Array<SchemaAST.Check<string>>) => String;
rebuild: (ast: SchemaAST.String) => String;
make: (input: string, options?: MakeOptions) => string;
makeOption: (input: string, options?: MakeOptions) => Option_.Option<string>;
makeEffect: (input: string, options?: MakeOptions) => Effect.Effect<string, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
TimeZoneString,
import SchemaTransformationSchemaTransformation.const timeZoneFromString: Transformation<
DateTime.TimeZone,
string
>
const timeZoneFromString: {
_tag: 'Transformation';
decode: SchemaGetter.Getter<T, E, RD>;
encode: SchemaGetter.Getter<E, T, RE>;
flip: () => SchemaTransformation.Transformation<string, DateTime.TimeZone, never, never>;
compose: (other: SchemaTransformation.Transformation<T2, DateTime.TimeZone, RD2, RE2>) => SchemaTransformation.Transformation<T2, string, RD2, RE2>;
}
Decodes a string into a DateTime.TimeZone and encodes a time zone back to
its string representation.
When to use
Use when you need a schema transformation to accept either an IANA time-zone
identifier or an offset string and produce a general DateTime.TimeZone.
Details
Accepted decode inputs include valid IANA identifiers and offset strings such
as "+03:00". Decode fails with InvalidValue when the string cannot be
parsed as a time zone.
timeZoneFromString
),
Annotations.Declaration<DateTime.TimeZone, readonly []>.toArbitrary?: Annotations.ToArbitrary.Declaration<DateTime.TimeZone, readonly []> | undefinedtoArbitrary: () => (fc: typeof FastCheckfc) =>
fc: typeof FastCheckfc.oneof(
fc: typeof FastCheckfc.integer({ min: numbermin: -12 * 60 * 60 * 1000, max: numbermax: 14 * 60 * 60 * 1000 }).map((n: anyn) => import DateTimeDateTime.zoneMakeOffset(n: anyn)),
fc: typeof FastCheckfc.constantFrom(
...["UTC", "Europe/London", "America/New_York", "Asia/Tokyo", "Australia/Sydney"].Array<string>.map<unknown>(callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any): unknown[]Calls a defined callback function on each element of an array, and returns an array that contains the results.
map(
import DateTimeDateTime.zoneMakeNamedUnsafe
)
)
),
Annotations.Declaration<DateTime.TimeZone, readonly []>.toFormatter?: Annotations.ToFormatter.Declaration<DateTime.TimeZone, readonly []> | undefinedtoFormatter: () => (tz: DateTime.TimeZonetz) => import DateTimeDateTime.zoneToString(tz: DateTime.TimeZonetz),
Annotations.Declaration<DateTime.TimeZone, readonly []>.toEquivalence?: Annotations.ToEquivalence.Declaration<DateTime.TimeZone, readonly []> | undefinedtoEquivalence: () => (a: DateTime.TimeZonea, b: DateTime.TimeZoneb) => import DateTimeDateTime.zoneToString(a: DateTime.TimeZonea) === import DateTimeDateTime.zoneToString(b: DateTime.TimeZoneb)
}
)