Real Birthday is the most accurate checker for valid birthdays. It fetches the birthday of the oldest person alive from Wikipedia to validate birthdays. Download our node NPM package.
This package can be used both client-side and server-side.
Install using NPM or yarn
NPM:
npm install --save real-birthday
Yarn:
yarn add real-birthday
Import isRealBirthday using ES6 import syntax
import isRealBirthday from "real-birthday";
or import isRealBirthday using CommonJS syntax
const isRealBirthday = require('real-birthday')
isRealBirthday accepts a Javascript Date object as an input and returns a boolean.
let bool = isRealBirthday(Date Object)
-
Invalid input type - returns an
Error
isRealBirthday("January 1st 2015")
-
Invalid Date - returns an
Error
isRealBirthday(new Date("Hi"))
-
Valid Birthday, but very vague - returns
true
isRealBirthday(new Date("2015"))
-
Valid Birthday - returns
true
isRealBirthday(new Date("2015-01-04"))
-
Invalid Birthday, this person is clearly lying - returns
false
isRealBirthday(new Date("1815-01-04"))
Try an example in React on CodePen!
Michael Lu |
Bill Marcy |
Alli Colyer |
Andrew Chien |