DateTimeZonedType-level representation of DateTimeZoned.
export interface DateTimeZoned 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.Zoned = /*unresolved*/ anyZoned> {
readonly "Rebuild": DateTimeZoned
}
const const DateTimeZonedString: Stringconst DateTimeZonedString: {
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; <…;
}
DateTimeZonedString = 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 zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"
})
/**
* Schema for `DateTime.Zoned` values.
*
* **Details**
*
* Default JSON serializer:
*
* - encodes offset zones as an ISO date-time with a numeric offset, such as
* `YYYY-MM-DDTHH:mm:ss.sss+HH:MM`
* - encodes named zones by appending the IANA identifier in brackets, such as
* `YYYY-MM-DDTHH:mm:ss.sss+HH:MM[Time/Zone]`
*
* @category DateTime
* @since 3.10.0
*/
export const const DateTimeZoned: DateTimeZonedconst DateTimeZoned: {
Rebuild: DateTimeZoned;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<DateTime.Zoned, readonly []>) => DateTimeZoned;
annotateKey: (annotations: Annotations.Key<DateTime.Zoned>) => DateTimeZoned;
check: (checks_0: SchemaAST.Check<DateTime.Zoned>, ...checks: Array<SchemaAST.Check<DateTime.Zoned>>) => DateTimeZoned;
rebuild: (ast: SchemaAST.Declaration) => DateTimeZoned;
make: (input: DateTime.Zoned, options?: MakeOptions) => DateTime.Zoned;
makeOption: (input: DateTime.Zoned, options?: MakeOptions) => Option_.Option<DateTime.Zoned>;
makeEffect: (input: DateTime.Zoned, options?: MakeOptions) => Effect.Effect<DateTime.Zoned, 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
DateTimeZoned
.
Schema for DateTime.Zoned values.
Details
Default JSON serializer:
- encodes offset zones as an ISO date-time with a numeric offset, such as
YYYY-MM-DDTHH:mm:ss.sss+HH:MM
- encodes named zones by appending the IANA identifier in brackets, such as
YYYY-MM-DDTHH:mm:ss.sss+HH:MM[Time/Zone]
DateTimeZoned: DateTimeZoned = 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(
(u: unknownu) => import DateTimeDateTime.isDateTime(u: unknownu) && import DateTimeDateTime.isZoned(u: DateTime.DateTimeu),
{
Annotations.Declaration<DateTime.Zoned, readonly []>.typeConstructor?: {
readonly [key: string]: unknown;
readonly _tag: string;
} | undefined
typeConstructor: {
_tag: string_tag: "effect/DateTime.Zoned"
},
Annotations.Declaration<DateTime.Zoned, readonly []>.generation?: {
readonly runtime: string;
readonly Type: string;
readonly Encoded?: string | undefined;
readonly importDeclaration?: string | undefined;
} | undefined
generation: {
runtime: stringruntime: `Schema.DateTimeZoned`,
type Type: stringType: `DateTime.Zoned`,
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.Zoned",
Annotations.Declaration<DateTime.Zoned, 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.Zoned = /*unresolved*/ anyZoned>()(
const DateTimeZonedString: Stringconst DateTimeZonedString: {
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; <…;
}
DateTimeZonedString,
import SchemaTransformationSchemaTransformation.const dateTimeZonedFromString: Transformation<
DateTime.Zoned,
string
>
const dateTimeZonedFromString: {
_tag: 'Transformation';
decode: SchemaGetter.Getter<T, E, RD>;
encode: SchemaGetter.Getter<E, T, RE>;
flip: () => SchemaTransformation.Transformation<string, DateTime.Zoned, never, never>;
compose: (other: SchemaTransformation.Transformation<T2, DateTime.Zoned, RD2, RE2>) => SchemaTransformation.Transformation<T2, string, RD2, RE2>;
}
Decodes a zoned date-time string into a DateTime.Zoned and encodes it back
to an ISO zoned string.
When to use
Use when you need a schema transformation for ISO zoned date-time strings
that decode to DateTime.Zoned and encode with DateTime.formatIsoZoned.
Details
Decode uses DateTime.makeZonedFromString and fails with InvalidValue when
the input is not a valid zoned date-time. Encode uses
DateTime.formatIsoZoned.
dateTimeZonedFromString
),
Annotations.Declaration<DateTime.Zoned, readonly []>.toArbitrary?: Annotations.ToArbitrary.Declaration<DateTime.Zoned, readonly []> | undefinedtoArbitrary: () => (fc: typeof FastCheckfc, ctx: Annotations.ToArbitrary.Context(parameter) ctx: {
constraint: ToArbitrary.GenerationConstraint | undefined;
recursion: ToArbitrary.Recursion | undefined;
}
ctx) =>
fc: typeof FastCheckfc.tuple(
fc: typeof FastCheckfc.date(function dateArbitraryConstraints<any>(
constraint:
| Annotations.ToArbitrary.GenerationConstraint
| undefined,
ordered:
| Annotations.ToArbitrary.OrderedConstraint<any>
| undefined,
base?: DateArbitraryConstraints | undefined,
toDate?:
| ((value: any) => globalThis.Date)
| undefined
): FastCheck.DateConstraints
dateArbitraryConstraints(
ctx: Annotations.ToArbitrary.Context(parameter) ctx: {
constraint: ToArbitrary.GenerationConstraint | undefined;
recursion: ToArbitrary.Recursion | undefined;
}
ctx?.Annotations.ToArbitrary.Context.constraint?: Annotations.ToArbitrary.GenerationConstraint | undefinedconstraint,
ctx: Annotations.ToArbitrary.Context(parameter) ctx: {
constraint: ToArbitrary.GenerationConstraint | undefined;
recursion: ToArbitrary.Recursion | undefined;
}
ctx?.Annotations.ToArbitrary.Context.constraint?: Annotations.ToArbitrary.GenerationConstraint | undefinedconstraint?.Annotations.ToArbitrary.GenerationConstraint.ordered?: Annotations.ToArbitrary.OrderedConstraint<any> | undefinedordered?.Annotations.ToArbitrary.OrderedConstraint<any>.order: Order.Order<T>order === import DateTimeDateTime.Order ? ctx: Annotations.ToArbitrary.Context(parameter) ctx: {
constraint: ToArbitrary.GenerationConstraint | undefined;
recursion: ToArbitrary.Recursion | undefined;
}
ctx.Annotations.ToArbitrary.Context.constraint?: Annotations.ToArbitrary.GenerationConstraint | undefined(property) Annotations.ToArbitrary.Context.constraint?: {
minLength: number | undefined;
maxLength: number | undefined;
patterns: readonly [string, ...Array<string>];
integer: boolean | undefined;
noInfinity: boolean | undefined;
noNaN: boolean | undefined;
valid: boolean | undefined;
unique: boolean | undefined;
ordered: OrderedConstraint<any> | undefined;
}
constraint.Annotations.ToArbitrary.GenerationConstraint.ordered?: Annotations.ToArbitrary.OrderedConstraint<any> | undefined(property) Annotations.ToArbitrary.GenerationConstraint.ordered?: {
order: Order.Order<T>;
minimum: T | undefined;
exclusiveMinimum: boolean | undefined;
maximum: T | undefined;
exclusiveMaximum: boolean | undefined;
}
ordered : var undefinedundefined,
{
max: globalThis.Datemax: new module globalThisglobalThis.var Date: DateConstructor
new (value: number | string | globalThis.Date) => globalThis.Date (+4 overloads)
Date(8640000000000000 - 14 * 60 * 60 * 1000),
min: globalThis.Datemin: new module globalThisglobalThis.var Date: DateConstructor
new (value: number | string | globalThis.Date) => globalThis.Date (+4 overloads)
Date(-8640000000000000 + 14 * 60 * 60 * 1000),
valid: booleanvalid: true
},
import DateTimeDateTime.toDateUtc
)),
fc: typeof FastCheckfc.constantFrom("UTC", "Europe/London", "America/New_York", "Asia/Tokyo", "Australia/Sydney")
).map(([date: anydate, zone: anyzone]) => import DateTimeDateTime.makeZonedUnsafe(date: anydate, { timeZone: anytimeZone: zone: anyzone })),
Annotations.Declaration<DateTime.Zoned, readonly []>.toFormatter?: Annotations.ToFormatter.Declaration<DateTime.Zoned, readonly []> | undefinedtoFormatter: () => (zoned: DateTime.Zoned(parameter) zoned: {
_tag: "Zoned";
epochMilliseconds: number;
zone: TimeZone;
adjustedEpochMilliseconds: number | undefined;
partsAdjusted: DateTime.PartsWithWeekday | undefined;
partsUtc: DateTime.PartsWithWeekday | undefined;
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; <…;
toString: () => string;
toJSON: () => unknown;
}
zoned) => import DateTimeDateTime.formatIsoZoned(zoned: DateTime.Zoned(parameter) zoned: {
_tag: "Zoned";
epochMilliseconds: number;
zone: TimeZone;
adjustedEpochMilliseconds: number | undefined;
partsAdjusted: DateTime.PartsWithWeekday | undefined;
partsUtc: DateTime.PartsWithWeekday | undefined;
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; <…;
toString: () => string;
toJSON: () => unknown;
}
zoned),
Annotations.Declaration<DateTime.Zoned, readonly []>.toEquivalence?: Annotations.ToEquivalence.Declaration<DateTime.Zoned, readonly []> | undefinedtoEquivalence: () => import DateTimeDateTime.Equivalence
}
)