npm

Need private packages and team management tools?Check out npm Orgs. »

korean-age

1.0.1 • Public • Published

Korean Age Calculator

Converts the regular age of a person into Korean age, which is up to two years more, depending on when you are born and the current date.

Installation

npm install korean-age

Usage

There is only one exported function called calcKoreanAge(birthday) which takes a birthday as the parameter. The birthday has to be a Date Object. The format should be Tue Nov 13 1990 00:00:00 GMT+0100 (Mitteleuropäische Normalzeit). When using a <input type="date" /> you just have to convert the event.target.value into a Date Object like so: let myBirthday = new Date(event.target.value);

calcKoreanAge(birthday) returns an Object with the fields westernAge and koreanAge of type number.

Example Code

import {calcKoreanAge} from 'korean-age';

let myBirthday = new Date('1997-03-14');
// you can set the hours to 00:00:00
myBirthday.setHours(0, 0, 0, 0,);

// call the function with the birthday as the parameter.
let ages = calcKoreanAge(myBirthday);

install

npm i korean-age

Downloadsweekly downloads

3

version

1.0.1

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability