It can parse anything the Date constructor can take as single parameter.
Date
If you need to accept Date only, use x.instanceOf(Date)
x.instanceOf(Date)
import * as x from 'unhoax'const schema = x.date// Datex.date.parse(new Date()) // succeeds// stringx.date.parse('2021-01-02T03:04:05.123Z') // succeedsx.date.parse('2021-01-02') // succeeds// numberx.date.parse(Date.now()) // succeeds Copy
import * as x from 'unhoax'const schema = x.date// Datex.date.parse(new Date()) // succeeds// stringx.date.parse('2021-01-02T03:04:05.123Z') // succeedsx.date.parse('2021-01-02') // succeeds// numberx.date.parse(Date.now()) // succeeds
It can parse anything the
Date
constructor can take as single parameter.If you need to accept
Date
only, usex.instanceOf(Date)