Design comparison
Solution retrospective
hello everyone ;) this challenge was not very simple, from the point of view of the implementation of the JS code, as I had to do several tests until I got to cover all the various types of possible errors by the user and related error messages.
Figuring out how to calculate age taking into account all possible variables, including whether or not the year is a leap year, also got me busy. But precisely for this reason it was a very useful challenge for the continuous learning of JS.
How do you think he solved the challenge? if you have any question/information/suggestion I'm here and we can discuss it..see you next time ;)
Community feedback
- @OlatoyanPosted about 1 year ago
Hello there, nice job in completing this task. There are quite a few bugs I noticed.
- I noticed you handled the error when the date is invalid which is great.
- Talking about error handling. I saw you wrote a code that calculates ages in leap year which is totally fantastic. I really love that. But when I input “Feb 29” in a year that’s not a leap year, I get an error which is great but somehow the age still get calculated. I wrote Feb 29 2020(which was a leap year) the age got calculated. But when I wrote Feb 29 2021(which isn’t a leap year) I got an error(which is great) but the age still got calculated.
- You wrote a code that checks if we input w future year. Which is superb. But I tried inputting something like this Dec 31 2023, now this is a future date but somehow it got calculated. My own advice on how this can be solved is to convert the date we inputted to a timestamp, and also convert the current date to a timestamp, then compare both. So if the timestamp of the date we inputted is higher than the current date timestamp, we should get an error
So Pablo, once again, nice job in completing the task. Dates are very tricky in JavaScript and I hope I’m able to help.
Marked as helpful1@p4bloxxPosted about 1 year ago@Olatoyan hello and first of all thanks for the feedback ;) I did the various tests you said and yes, I thought I had foreseen all the various error cases but no, I left some.
Now I'm going to fix the various errors and as regards the issue of the future date I'll try to do as you advised me and there shouldn't be any problems.
Thanks again for the help, see you next time ;)
1@OlatoyanPosted about 1 year ago@p4bloxx You’re welcome bro. You’ve absolutely got this✊🏽
1
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