Age calculator with React, tailwindcss and day.js date library
Design comparison
Solution retrospective
The most useful step I made was to research for Date related libraries or packages that simplifies the process of validating user date and I'm happy with that.
I was able to validate user input by using day.js isValid
method that requires a date and date format and it automatically parse it and checks for validation.
It was challenging to detect month and day cycle and implement the logic of adding or subtracting month difference.
I solved by having multiple if else conditions that checks if birth month is before or ahead of current month to add or subtract and otherwise not adding if month difference is zero.
What specific areas of your project would you like help with?I would like to hear your feedback on my age calculation approach and any other feedback will be gladly appreciated. Thanks!
Community feedback
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord