Add .validDate() (#203)

This commit is contained in:
Martin Eneqvist 2024-02-29 08:23:30 +01:00 committed by GitHub
parent 0e687a23a8
commit e9418fe1b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 56 additions and 0 deletions

View file

@ -2101,6 +2101,17 @@ test('is.urlSearchParams', t => {
});
});
test('is.validDate', t => {
t.true(is.validDate(new Date()));
t.false(is.validDate(new Date('x')));
t.notThrows(() => {
assert.validDate(new Date());
});
t.throws(() => {
assert.validDate(new Date('x'));
});
});
test('is.validLength', t => {
t.true(is.validLength(1));
t.true(is.validLength(0));