Welcome to the Tiny Age Calculator This is a Node.js-based simple CLI script that calculates a user's age based on their input (year, month, and day of birth). The app prompts the user for their name and birth details, then calculates and displays their exact age in years, months, and days.
- Command-line interface to interact with the user.
- Input validation to ensure proper date format.
- Calculation of the user's exact age, including handling negative day/month offsets.
Before you begin, ensure you have the following installed on your machine:
- Node.js: Version 12 or higher
- npm: Comes with Node.js (Verify installation with
node -v
andnpm -v
)
Follow the instructions below to clone and run the project on your local machine.
Use the following command to clone this repository to your local machine:
git clone https://github.com/sheikhmohdnazmulhasan/nodejs-readline-age-calculator.git
cd nodejs-readline-age-calculator
Now you can run the script using the following command:
node script.js
This will launch the CLI and prompt you to enter your name, year, month, and day of birth. After entering your details, the script will calculate and display your age.
Welcome To Tiny Age Calculator!
What is Your Name Buddy? John
In which year were you born? 1995
In which month were you born (1-12)? 7
On which day were you born? 15
Hello John! Your Age is:
28 years, 2 months, and 8 days.
.
├── script.js # Main file containing the age calculator logic
├── README.md # Project documentation
Contributions are welcome! Please fork the repository and submit a pull request with your improvements.