验证
返回 boolean
指示 Dayjs
的日期是否有效。
不严格检查。
仅检查该值是否可以解析为日期时间。
dayjs('2022-01-33').isValid(); // true, parsed to 2022-02-02 dayjs('some invalid string').isValid(); // false
严格检查。
检查该值是否可以解析为日期时间并且它是有效日期。 必须提供最后两个参数
format
和strict
。This requires the
CustomParseFormat
plugin to workdayjs('2022-02-31', 'YYYY-MM-DD', true).isValid(); // false