Design comparison
Solution retrospective
This project allows me to work with the Date object. The tricky part is to calculate the exact age. If you have a tool or the best way to do that, please help me.
Community feedback
- @FloRiouffreytPosted over 1 year ago
Hi! It's tough to work on dates and time with vanilla JS, good work! Take a look at the Day JS library, great for manipulating time! https://day.js.org/docs/en/installation/installation. FrontEndMentor wants me to write a longer feedback to validate the post, so here are a few useless words... but still, Days JS is awesome
Marked as helpful0@Darren-Code34Posted over 1 year agoThank you @FloRiouffreyt, I will take a look at this library.
0 - @daniel-web-developerPosted over 1 year ago
It's really hard to come up with an algorithm to calculate the time span, so I used the following library https://github.com/datejs/Datejs. It has a function that adds (so be attentive to this and remember to add a - (minus signal) before the input values) to a given date.
In my code, I only had to get data from the user, get today's date (you can either use vanilla JavaScript or the Datejs library for that), use Datejs's .add() function, and return the values.
0
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