Skip to main content

Class: DateSchema<TType, TContext, TOut>

yup.DateSchema

Type parameters​

NameType
TTypeextends Maybe<Date> = Date | undefined
TContextextends AnyObject = AnyObject
TOutextends TType = TType

Hierarchy​

  • BaseSchema<TType, TContext, TOut>

    ↳ DateSchema

Constructors​

constructor​

• new DateSchema<TType, TContext, TOut>()

Type parameters​

NameType
TTypeextends Maybe<Date> = undefined | Date
TContextextends AnyObject = AnyObject
TOutextends Maybe<Date> = TType

Overrides​

BaseSchema.constructor

Properties​

__inputType​

• Readonly __inputType: TType

Inherited from​

BaseSchema.__inputType


__isYupSchema__​

• Readonly __isYupSchema__: boolean

Inherited from​

BaseSchema.isYupSchema


__outputType​

• Readonly __outputType: TOut

Inherited from​

BaseSchema.__outputType


_blacklist​

• Protected _blacklist: default

Inherited from​

BaseSchema._blacklist


_whitelist​

• Protected _whitelist: default

Inherited from​

BaseSchema._whitelist


deps​

• Readonly deps: readonly string[]

Inherited from​

BaseSchema.deps


equals​

• equals: <U>(enums: (default<unknown> | Maybe<U>)[], message?: Message<{ values: any }>) => BaseSchema<any, AnyObject, any>

Type declaration​

â–¸ <U>(enums, message?): BaseSchema<any, AnyObject, any>

Type parameters​
NameType
Uextends any
Parameters​
NameType
enums(default<unknown> | Maybe<U>)[]
message?Message<{ values: any }>
Returns​

BaseSchema<any, AnyObject, any>

Inherited from​

BaseSchema.equals


exclusiveTests​

• Protected exclusiveTests: Record<string, boolean>

Inherited from​

BaseSchema.exclusiveTests


is​

• is: <U>(enums: (default<unknown> | Maybe<U>)[], message?: Message<{ values: any }>) => BaseSchema<any, AnyObject, any>

Type declaration​

â–¸ <U>(enums, message?): BaseSchema<any, AnyObject, any>

Type parameters​
NameType
Uextends any
Parameters​
NameType
enums(default<unknown> | Maybe<U>)[]
message?Message<{ values: any }>
Returns​

BaseSchema<any, AnyObject, any>

Inherited from​

BaseSchema.is


nope​

• nope: <U>(enums: (default<unknown> | Maybe<U>)[], message?: Message<{ values: any }>) => BaseSchema<any, AnyObject, any>

Type declaration​

â–¸ <U>(enums, message?): BaseSchema<any, AnyObject, any>

Type parameters​
NameType
Uextends any
Parameters​
NameType
enums(default<unknown> | Maybe<U>)[]
message?Message<{ values: any }>
Returns​

BaseSchema<any, AnyObject, any>

Inherited from​

BaseSchema.nope


not​

• not: <U>(enums: (default<unknown> | Maybe<U>)[], message?: Message<{ values: any }>) => BaseSchema<any, AnyObject, any>

Type declaration​

â–¸ <U>(enums, message?): BaseSchema<any, AnyObject, any>

Type parameters​
NameType
Uextends any
Parameters​
NameType
enums(default<unknown> | Maybe<U>)[]
message?Message<{ values: any }>
Returns​

BaseSchema<any, AnyObject, any>

Inherited from​

BaseSchema.not


prepareParam​

• Private prepareParam: any


spec​

• spec: SchemaSpec<any>

Inherited from​

BaseSchema.spec


tests​

• tests: Test[]

Inherited from​

BaseSchema.tests


transforms​

• transforms: TransformFunction<AnySchema<any, any, any>>[]

Inherited from​

BaseSchema.transforms


type​

• Readonly type: string

Inherited from​

BaseSchema.type


INVALID_DATE​

â–ª Static INVALID_DATE: Date

Accessors​

_type​

• get _type(): string

Returns​

string

Inherited from​

BaseSchema._type

Methods​

_cast​

â–¸ Protected _cast(rawValue, _options): any

Parameters​

NameType
rawValueany
_optionsCastOptions<TContext>

Returns​

any

Inherited from​

BaseSchema._cast


_getDefault​

â–¸ Protected _getDefault(): any

Returns​

any

Inherited from​

BaseSchema._getDefault


_isPresent​

â–¸ Protected _isPresent(value): boolean

Parameters​

NameType
valueunknown

Returns​

boolean

Inherited from​

BaseSchema._isPresent


_typeCheck​

â–¸ Protected _typeCheck(v): v is NonNullable<TType>

Parameters​

NameType
vany

Returns​

v is NonNullable<TType>

Overrides​

BaseSchema._typeCheck


_validate​

â–¸ Protected _validate(_value, options, cb): void

Parameters​

NameType
_valueany
optionsundefined | InternalOptions<TContext>
cbCallback<any>

Returns​

void

Inherited from​

BaseSchema._validate


cast​

â–¸ cast(value, options?): TType

Parameters​

NameType
valueany
options?CastOptions<TContext>

Returns​

TType

Inherited from​

BaseSchema.cast


clone​

â–¸ clone(spec?): DateSchema<TType, TContext, TOut>

Parameters​

NameType
spec?Partial<SchemaSpec<any>>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.clone


concat​

â–¸ concat<TOther>(schema): TOther

Type parameters​

NameType
TOtherextends DateSchema<any, any, any, TOther>

Parameters​

NameType
schemaTOther

Returns​

TOther

Inherited from​

BaseSchema.concat


default​

â–¸ default<D>(def): If<D, DateSchema<undefined | TType, TContext, undefined | TType>, DateSchema<Defined<TType>, TContext, Defined<TType>>>

Type parameters​

NameType
Dextends Maybe<Date>

Parameters​

NameType
defThunk<D>

Returns​

If<D, DateSchema<undefined | TType, TContext, undefined | TType>, DateSchema<Defined<TType>, TContext, Defined<TType>>>

Inherited from​

BaseSchema.default


defined​

â–¸ defined(msg?): DefinedDateSchema<TType, TContext>

Parameters​

NameType
msg?Message<{}>

Returns​

DefinedDateSchema<TType, TContext>

Inherited from​

BaseSchema.defined


describe​

â–¸ describe(): SchemaDescription

Returns​

SchemaDescription

Inherited from​

BaseSchema.describe


getDefault​

â–¸ getDefault(options?): TType

Parameters​

NameType
options?ResolveOptions<any>

Returns​

TType

Inherited from​

BaseSchema.getDefault


isType​

â–¸ isType(v): boolean

Parameters​

NameType
vany

Returns​

boolean

Inherited from​

BaseSchema.isType


isValid​

â–¸ isValid(value, options?): Promise<boolean>

Parameters​

NameType
valueany
options?ValidateOptions<TContext>

Returns​

Promise<boolean>

Inherited from​

BaseSchema.isValid


isValidSync​

â–¸ isValidSync(value, options?): value is TOut

Parameters​

NameType
valueany
options?ValidateOptions<TContext>

Returns​

value is TOut

Inherited from​

BaseSchema.isValidSync


label​

â–¸ label(label): DateSchema<TType, TContext, TOut>

Parameters​

NameType
labelstring

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.label


max​

â–¸ max(max, message?): DateSchema<TType, TContext, TOut>

Parameters​

NameType
maxunknown
message?Message<{ max: string | Date }>

Returns​

DateSchema<TType, TContext, TOut>


meta​

â–¸ meta(): undefined | Record<string, unknown>

Returns​

undefined | Record<string, unknown>

Inherited from​

BaseSchema.meta

â–¸ meta(obj): DateSchema<TType, TContext, TOut>

Parameters​

NameType
objRecord<string, unknown>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.meta


min​

â–¸ min(min, message?): DateSchema<TType, TContext, TOut>

Parameters​

NameType
minunknown
message?Message<{ min: string | Date }>

Returns​

DateSchema<TType, TContext, TOut>


notOneOf​

â–¸ notOneOf<U>(enums, message?): DateSchema<TType, TContext, TOut>

Type parameters​

NameType
Uextends Maybe<Date>

Parameters​

NameType
enums(default<unknown> | Maybe<U>)[]
message?Message<{ values: any }>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.notOneOf


notRequired​

â–¸ notRequired(): DateSchema<TType, TContext, TType>

Returns​

DateSchema<TType, TContext, TType>

Inherited from​

BaseSchema.notRequired


nullable​

â–¸ nullable(isNullable?): DateSchema<null | TType, TContext, null | TType>

Parameters​

NameType
isNullable?true

Returns​

DateSchema<null | TType, TContext, null | TType>

Inherited from​

BaseSchema.nullable

â–¸ nullable(isNullable): DateSchema<Exclude<TType, null>, TContext, Exclude<TType, null>>

Parameters​

NameType
isNullablefalse

Returns​

DateSchema<Exclude<TType, null>, TContext, Exclude<TType, null>>

Inherited from​

BaseSchema.nullable


oneOf​

â–¸ oneOf<U>(enums, message?): DateSchema<TType, TContext, TOut>

Type parameters​

NameType
Uextends Maybe<Date>

Parameters​

NameType
enums(default<unknown> | Maybe<U>)[]
message?Message<{ values: any }>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.oneOf


optional​

â–¸ optional(): DateSchema<TType, TContext, TType>

Returns​

DateSchema<TType, TContext, TType>

Inherited from​

BaseSchema.optional


required​

â–¸ required(msg?): RequiredDateSchema<TType, TContext>

Parameters​

NameType
msg?Message<{}>

Returns​

RequiredDateSchema<TType, TContext>

Inherited from​

BaseSchema.required


resolve​

â–¸ resolve(options): DateSchema<TType, TContext, TOut>

Parameters​

NameType
optionsResolveOptions<any>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.resolve


strict​

â–¸ strict(isStrict?): DateSchema<TType, TContext, TOut>

Parameters​

NameType
isStrict?boolean

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.strict


strip​

â–¸ strip(strip?): DateSchema<TType, TContext, TOut>

Parameters​

NameType
strip?boolean

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.strip


test​

â–¸ test(options): DateSchema<TType, TContext, TOut>

Adds a test function to the schema's queue of tests. tests can be exclusive or non-exclusive.

  • exclusive tests, will replace any existing tests of the same name.
  • non-exclusive: can be stacked

If a non-exclusive test is added to a schema with an exclusive test of the same name the exclusive test is removed and further tests of the same name will be stacked.

If an exclusive test is added to a schema with non-exclusive tests of the same name the previous tests are removed and further tests of the same name will replace each other.

Parameters​

NameType
optionsTestConfig<TType, TContext>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.test

â–¸ test(test): DateSchema<TType, TContext, TOut>

Parameters​

NameType
testTestFunction<TType, TContext>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.test

â–¸ test(name, test): DateSchema<TType, TContext, TOut>

Parameters​

NameType
namestring
testTestFunction<TType, TContext>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.test

â–¸ test(name, message, test): DateSchema<TType, TContext, TOut>

Parameters​

NameType
namestring
messageMessage<{}>
testTestFunction<TType, TContext>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.test


transform​

â–¸ transform(fn): DateSchema<TType, TContext, TOut>

Parameters​

NameType
fnTransformFunction<DateSchema<TType, TContext, TOut>>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.transform


typeError​

â–¸ typeError(message): DateSchema<TType, TContext, TOut>

Parameters​

NameType
messageMessage<{}>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.typeError


validate​

â–¸ validate(value, options?): Promise<TOut>

Parameters​

NameType
valueany
options?ValidateOptions<TContext>

Returns​

Promise<TOut>

Inherited from​

BaseSchema.validate


validateAt​

â–¸ validateAt(path, value, options?): Promise<TOut>

Parameters​

NameType
pathstring
valueany
options?ValidateOptions<TContext>

Returns​

Promise<TOut>

Inherited from​

BaseSchema.validateAt


validateSync​

â–¸ validateSync(value, options?): TOut

Parameters​

NameType
valueany
options?ValidateOptions<TContext>

Returns​

TOut

Inherited from​

BaseSchema.validateSync


validateSyncAt​

â–¸ validateSyncAt(path, value, options?): TOut

Parameters​

NameType
pathstring
valueany
options?ValidateOptions<TContext>

Returns​

TOut

Inherited from​

BaseSchema.validateSyncAt


when​

â–¸ when(options): DateSchema<TType, TContext, TOut>

Parameters​

NameType
optionsConditionOptions<DateSchema<TType, TContext, TOut>>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.when

â–¸ when(keys, options): DateSchema<TType, TContext, TOut>

Parameters​

NameType
keysstring | string[]
optionsConditionOptions<DateSchema<TType, TContext, TOut>>

Returns​

DateSchema<TType, TContext, TOut>

Inherited from​

BaseSchema.when


withMutation​

â–¸ withMutation<T>(fn): T

Type parameters​

Name
T

Parameters​

NameType
fn(schema: DateSchema<TType, TContext, TOut>) => T

Returns​

T

Inherited from​

BaseSchema.withMutation