1.0.2 • Published 1 year ago

@kh71/error-middleware v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

This Package fork form full-age-calculator by akhilsky.

README

This Package will help you to get exact age and minor or adulst status from Date of Birth to current Date or some other Date.

Install

npm i -S kh71-age-calculator

Usage

How to Get Full Age(Years,Months & Days)

Get full age on current Date
var calculateFullAge = require('kh71-age-calculator');

var getfullAge = calculateFullAge.getFullAge('birthDate'); // In yyyy-mm-dd format. example: 1998-12-25
console.log(getfullAge)

Output

{ "years":xx, "months":xx, "days":xx }
Get full age on some other Date
var getfullAge = calculateFullAge.getFullAge('birthDate','otherDate'); // In yyyy-mm-dd format. Example: 1999-12-25, 2022-10-31
console.log(getfullAge)

Output

{ "years": 22, "months": 10, "days": 6 }

How to Get Full Age Status(Minor/Adult)

Get Age Status on current Date
var ageStatus = calculateFullAge.getAgeStatus('birthDate'); In yyyy-mm-dd format. Example: 1999-12-25
console.log(ageStatus);

Output

output: "Adult"
Get Age Status on some other Date
var ageStatus = calculateFullAge.getAgeStatus('birthDate','otherDate'); In yyyy-mm-dd format. example: 1998-12-25, 2022-10-31
console.log(ageStatus);

Output

output: "Adult"

License

MIT

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago