This repository contains the source code for an age calculator application that fulfills the requirements of the Frontend Mentor challenge: "View an age in years, months, and days after submitting a valid date through the form."
Users should be able to:
- View an age in years, months, and days after submitting a valid date through the form
- Receive validation errors if:
- Any field is empty when the form is submitted
- The day number is not between 1-31
- The month number is not between 1-12
- The year is in the future
- The date is invalid e.g. 31/04/1991 (there are 30 days in April)
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- Bonus: See the age numbers animate to their final number when the form is submitted
Features:
- Calculates age based on a user-submitted date.
- Validates user input for empty fields, invalid dates, and out-of-range day/month values.
- Displays the calculated age in a clear and responsive layout using a media query or a CSS framework like Tailwind CSS.
- Implements hover and focus states for interactive elements (buttons, input fields).
- Used React Spring To Animate the age numbers to their final number when the form is submitted
Technologies:
- React - JS library
- TailwindCSS - For styles
- React Spring - Animation library
- HTML
- CSS
- JavaScript
- Clone the repository to your local machine using the command:
git clone https://github.com/rohanvron/Age-Calculator-App.git
- Navigate to the project directory:
cd Age-Calculator-App
- Install the necessary dependencies using npm or yarn:
npm install
oryarn install
The project uses the following dependencies:
Install Vite globally if you haven't already: npm install -g create-vite@latest
or yarn create vite@latest
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
if you’re looking to enhance it, here are a few suggestions:
- Implement dark/light mode theme switching (optional).
- Enhance user experience with additional animations or interactive features.
This project is licensed under the MIT License. See the LICENSE
file for more details.