bupkis
    Preparing search index...

    Interface ZodDate

    interface ZodDate {
        minDate: null | Date;
        maxDate: null | Date;
        def: $ZodDateDef;
        type: "date";
        _def: $ZodDateDef;
        _output: Date;
        _input: Date;
        spa: (
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ) => Promise<ZodSafeParseResult<Date>>;
        description?: string;
        _zod: $ZodDateInternals;
        "~standard": $ZodStandardSchema<z.ZodDate>;
        min(
            value: number | Date,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                    message?: string;
                },
        ): this;
        max(
            value: number | Date,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                    message?: string;
                },
        ): this;
        check(...checks: (CheckFn<Date> | z.core.$ZodCheck<Date>)[]): this;
        clone(def?: $ZodDateDef, params?: { parent: boolean }): this;
        register<
            R extends
                $ZodRegistry<
                    MetadataType,
                    z.core.$ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>,
                >,
        >(
            registry: R,
            ...meta: z.ZodDate extends R["_schema"]
                ? undefined extends R["_meta"]
                    ? [$replace<R["_meta"], R["_schema"] & z.ZodDate>?]
                    : [$replace<R["_meta"], R["_schema"] & z.ZodDate>]
                : ["Incompatible schema"],
        ): this;
        brand<T extends PropertyKey = PropertyKey>(
            value?: T,
        ): PropertyKey extends T ? z.ZodDate : $ZodBranded<z.ZodDate, T>;
        parse(data: unknown, params?: ParseContext<$ZodIssue>): Date;
        safeParse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<Date>;
        parseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<Date>;
        safeParseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<Date>>;
        encode(data: Date, params?: ParseContext<$ZodIssue>): Date;
        decode(data: Date, params?: ParseContext<$ZodIssue>): Date;
        encodeAsync(data: Date, params?: ParseContext<$ZodIssue>): Promise<Date>;
        decodeAsync(data: Date, params?: ParseContext<$ZodIssue>): Promise<Date>;
        safeEncode(
            data: Date,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<Date>;
        safeDecode(
            data: Date,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<Date>;
        safeEncodeAsync(
            data: Date,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<Date>>;
        safeDecodeAsync(
            data: Date,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<Date>>;
        refine(
            check: (arg: Date) => unknown,
            params?:
                | string
                | {
                    abort?: boolean;
                    when?: (payload: ParsePayload) => boolean;
                    path?: PropertyKey[];
                    params?: Record<string, any>;
                    error?: string | $ZodErrorMap<NonNullable<$ZodIssue>>;
                    message?: string;
                },
        ): this;
        superRefine(
            refinement: (
                arg: Date,
                ctx: $RefinementCtx<Date>,
            ) => void | Promise<void>,
        ): this;
        overwrite(fn: (x: Date) => Date): this;
        optional(): z.ZodOptional<z.ZodDate>;
        nonoptional(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidType<unknown>>;
                    message?: string;
                },
        ): z.ZodNonOptional<z.ZodDate>;
        nullable(): z.ZodNullable<z.ZodDate>;
        nullish(): z.ZodOptional<z.ZodNullable<z.ZodDate>>;
        default(def: Date): z.ZodDefault<z.ZodDate>;
        default(def: () => Date): z.ZodDefault<z.ZodDate>;
        prefault(def: () => Date): z.ZodPrefault<z.ZodDate>;
        prefault(def: Date): z.ZodPrefault<z.ZodDate>;
        array(): z.ZodArray<z.ZodDate>;
        or<T extends SomeType>(option: T): z.ZodUnion<[z.ZodDate, T]>;
        and<T extends SomeType>(incoming: T): z.ZodIntersection<z.ZodDate, T>;
        transform<NewOut>(
            transform: (
                arg: Date,
                ctx: $RefinementCtx<Date>,
            ) => NewOut | Promise<NewOut>,
        ): z.ZodPipe<z.ZodDate, z.ZodTransform<Awaited<NewOut>, Date>>;
        catch(def: Date): z.ZodCatch<z.ZodDate>;
        catch(def: (ctx: $ZodCatchCtx) => Date): z.ZodCatch<z.ZodDate>;
        pipe<T extends z.core.$ZodType<any, Date, $ZodTypeInternals<any, Date>>>(
            target: T | z.core.$ZodType<any, Date, $ZodTypeInternals<any, Date>>,
        ): z.ZodPipe<z.ZodDate, T>;
        readonly(): z.ZodReadonly<z.ZodDate>;
        describe(description: string): this;
        meta(): | undefined
        | {
            id?: string;
            title?: string;
            description?: string;
            deprecated?: boolean;
            [key: string]: unknown;
        };
        meta(
            data: {
                id?: string;
                title?: string;
                description?: string;
                deprecated?: boolean;
                [key: string]: unknown;
            },
        ): this;
        isOptional(): boolean;
        isNullable(): boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    minDate: null | Date

    Not recommended.

    maxDate: null | Date

    Not recommended.

    type: "date"

    Use .def instead.

    _output: Date

    Use z.output<typeof schema> instead.

    _input: Date

    Use z.input<typeof schema> instead.

    spa: (
        data: unknown,
        params?: ParseContext<$ZodIssue>,
    ) => Promise<ZodSafeParseResult<Date>>
    description?: string

    Methods

    • Parameters

      • value: number | Date
      • Optionalparams:
            | string
            | {
                abort?: boolean;
                error?: string
                | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                message?: string;
            }
        • string
        • {
              abort?: boolean;
              error?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
              message?: string;
          }
          • Optionalabort?: boolean

            If true, no later checks will be executed if this check fails. Default false.

          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

      Returns this

    • Parameters

      • value: number | Date
      • Optionalparams:
            | string
            | {
                abort?: boolean;
                error?: string
                | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                message?: string;
            }
        • string
        • {
              abort?: boolean;
              error?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
              message?: string;
          }
          • Optionalabort?: boolean

            If true, no later checks will be executed if this check fails. Default false.

          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

      Returns this

    • Parameters

      • Optionaldef: $ZodDateDef
      • Optionalparams: { parent: boolean }

      Returns this

    • Parameters

      • check: (arg: Date) => unknown
      • Optionalparams:
            | string
            | {
                abort?: boolean;
                when?: (payload: ParsePayload) => boolean;
                path?: PropertyKey[];
                params?: Record<string, any>;
                error?: string | $ZodErrorMap<NonNullable<$ZodIssue>>;
                message?: string;
            }
        • string
        • {
              abort?: boolean;
              when?: (payload: ParsePayload) => boolean;
              path?: PropertyKey[];
              params?: Record<string, any>;
              error?: string | $ZodErrorMap<NonNullable<$ZodIssue>>;
              message?: string;
          }
          • Optionalabort?: boolean

            If true, no later checks will be executed if this check fails. Default false.

          • Optionalwhen?: (payload: ParsePayload) => boolean

            If provided, this check will only be executed if the function returns true. Defaults to payload => z.util.isAborted(payload).

          • Optionalpath?: PropertyKey[]
          • Optionalparams?: Record<string, any>
          • Optionalerror?: string | $ZodErrorMap<NonNullable<$ZodIssue>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

      Returns this

    • Parameters

      Returns this

    • Returns a new instance that has been registered in z.globalRegistry with the specified description

      Parameters

      • description: string

      Returns this

    • Returns the metadata associated with this instance in z.globalRegistry

      Returns
          | undefined
          | {
              id?: string;
              title?: string;
              description?: string;
              deprecated?: boolean;
              [key: string]: unknown;
          }

    • Returns a new instance that has been registered in z.globalRegistry with the specified metadata

      Parameters

      • data: {
            id?: string;
            title?: string;
            description?: string;
            deprecated?: boolean;
            [key: string]: unknown;
        }

      Returns this

    • Returns boolean

      Try safe-parsing undefined (this is what isOptional does internally):

      const schema = z.string().optional();
      const isOptional = schema.safeParse(undefined).success; // true
    • Returns boolean

      Try safe-parsing null (this is what isNullable does internally):

      const schema = z.string().nullable();
      const isNullable = schema.safeParse(null).success; // true