This package calculates the exact age of a given date of birth.
npm install exact-age
or
pnpm install exact-age
or
yarn add exact-age
const exactAge = require("exact-age");
// Using String format
// Assuming the current day as 03-20-2024
const dob = "03-20-2000";
const age = exactAge(dob); // Output: 24
// Using Date format
// Assuming the current day as 03-20-2024
const dob = new Date("06-22-2005");
const age = exactAge(dob); // Output: 19
import exactAge from "exact-age";
// Using String format
// Assuming the current day as 03-20-2024
const dob = "03-20-2000";
const age = exactAge(dob); // Output: 24
// Using Date format
// Assuming the current day as 03-20-2024
const dob = new Date("06-22-2005");
const age = exactAge(dob); // Output: 19
This project is licensed under the MIT License.