real-birthday

1.0.3 • Public • Published

Real Birthday

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.

Documentation

This package can be used both client-side and server-side.

Installation

Install using NPM or yarn

NPM: npm install --save real-birthday

Yarn: yarn add real-birthday

Usage

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)

Examples

  1. Invalid input type - returns an Error

    isRealBirthday("January 1st 2015")
    
  2. Invalid Date - returns an Error

    isRealBirthday(new Date("Hi"))
    
  3. Valid Birthday, but very vague - returns true

    isRealBirthday(new Date("2015"))
    
  4. Valid Birthday - returns true

    isRealBirthday(new Date("2015-01-04"))
    
  5. Invalid Birthday, this person is clearly lying - returns false

    isRealBirthday(new Date("1815-01-04"))
    

React Example

Try an example in React on CodePen!

Edit stupefied-wildflower-tu6mc

Created by

Picture of Michael Lu
Michael Lu
Picture of Bill Marcy
Bill Marcy
Picture of Allison Colyer
Alli Colyer
Picture of Andrew Chien
Andrew Chien

/real-birthday/

    Package Sidebar

    Install

    npm i real-birthday

    Weekly Downloads

    3

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    4.16 kB

    Total Files

    3

    Last publish

    Collaborators

    • achien
    • allicolyer
    • hwacha
    • michaelwlu