is-valid-birthdate

Check if a string or date object is a valid birthdate.


Keywords
is birthdate, is birth date, valid birth date, valid birthdate, birthdate check, birth date check
License
MIT
Install
npm install is-valid-birthdate@0.1.0

Documentation

is-valid-birthdate npm version Build Status

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