Design comparison
Solution retrospective
😆 Why was the JavaScript developer sad? Because they didn't Node how to Express themselves!
Hi there! I'm excited to share my process for creating the age calculator UI and logic as well. For starters, I used HTML to structure the content, CSS for styling, and JavaScript to add interactivity and logic.
I organized the CSS and JavaScript using variables, modular components, and comments for readability. However, I struggled a bit with the date calculation logic in JavaScript.
Specifically, I'm having an issue accurately calculating the number of months and days between the input date and the current date. As you can see in the JavaScript, I tried dividing the timestamp difference by milliseconds in a day and year to get the years, then months and days.
However, the day's result seems to be off by a few days from the actual age. I think it's related to how I'm handling the date conversion to account for timezone offsets.
If you have any tips on how I can improve the date difference calculation to get precise month and day values, I'd really appreciate it! I'm always looking to get better at date logic in JS. Overall, this was a fun challenge to build a nice user experience that works across devices. 💻
Hope you enjoyed the joke, too. Coding can be serious work so we have to laugh sometimes! Looking forward to your thoughts.
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