This is a simple NextJs component that calculates your age.
Install the package via npm:
npm install age-ts
pnpm:
pnpm i age-ts
or yarn:
yarn add age-ts
Import the Age
component and use it in your NextJS application:
"use-client";
import Age from "age-ts";
function App() {
return <Age />;
}
export default App;
Set the BIRTHDATE
environment variable in the following format:
NEXT_PUBLIC_BIRTHDATE = '<your birthdate here>'
Or just pass the birthdate
argument through the component like this:
"use-client";
import Age from "age-ts";
function App() {
return <Age birthdate='01-01-2001' />;
}
export default App;