is-valid-birthdate
v0.1.0
Published
Check if a string or date object is a valid birthdate.
Downloads
1,446
Maintainers
Readme
is-valid-birthdate
Check if a string or date object is a valid birthdate.
Install
$ npm install --save is-valid-birthdate
Usage
const isValidBirthdate = require('is-valid-birthdate')
isValidBirthdate('1998/02/26') // => true
isValidBirthdate('2014/12/03', { minAge: 18 }) // => false
isValidBirthdate(new Date()) // => false
isValidBirthdate('2025-12-26') // => false
API
isValidBirthdate(date[, options])
date
Type: string
or Date object
options
Type: object
Default: { maxAge: 120, minAge: 0 }
License
MIT