1.0.3 • Published 5 years ago

real-birthday v1.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

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

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago