Add .validDate()
This commit is contained in:
parent
0e687a23a8
commit
f8f85516af
3 changed files with 40 additions and 0 deletions
14
readme.md
14
readme.md
|
|
@ -574,6 +574,20 @@ is.all(is.string, '🦄', [], 'unicorns');
|
|||
//=> false
|
||||
```
|
||||
|
||||
##### .validDate(value)
|
||||
|
||||
Returns `true` if the value is a valid date.
|
||||
|
||||
`Invalid Date`s occur when an invalid value is passed to the `Date` constructor. This can be an invalid date string, a non-numeric value or a number that is outside of the expected range for a date value.
|
||||
|
||||
```js
|
||||
is.validDate(new Date());
|
||||
//=> true
|
||||
|
||||
is.validDate(new Date('unicorn'));
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .validLength(value)
|
||||
|
||||
Returns `true` if the value is a safe integer that is greater than or equal to zero.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue