Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Age calculator app

Ouss_Achβ€’ 780

@OUSSAMAACHICHE

Desktop design screenshot for the Age calculator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


*Hi there I had many problems with this project. I do not know how to calculate age, and I faced issues with logic. Please, can anyone help me?

Community feedback

Louβ€’ 110

@LouMauriege

Posted

Hi! You made a pretty good job yet.

To calculate difference between two dates you can create two dates and subtract them.

You create the variable date on script.js.line.16, you can create another on with the input values that the user gives you. Then you can subtract those dates, and you'll have the difference between those two dates in milliseconds. After that you just had to divide, this result with the number of milliseconds in one year and the result of it should be the years between your two dates. Then take the modulo of this division and divide it with the numbers of milliseconds in one month and so on till you get the years, month and days between your two dates.

Hope it will help you :)

Marked as helpful

1

Ouss_Achβ€’ 780

@OUSSAMAACHICHE

Posted

@LouMauriege Thanks for this valuable help , Can you explain to me the simple code? πŸ€·β€β™‚οΈ

1
Louβ€’ 110

@LouMauriege

Posted

@OUSSAMAACHICHE

Ok, I think that the best code to explain this to you might the code of @HaarithBinSabur go check the github repo to see how he did it. In this ( https://github.com/HaarithBinSabur/age-calculator-component/blob/main/app.js ) javascript file from the line 27 to the line 33, you'll see his method witch is mostly the best one to explain how to calculate age from milliseconds.

Hope it will help feel free to ask more questions if needed ;)

Marked as helpful

1
Ouss_Achβ€’ 780

@OUSSAMAACHICHE

Posted

Thank you soo much 😍@LouMauriege

1
Louβ€’ 110

@LouMauriege

Posted

@OUSSAMAACHICHE It's allways a pleasure to help, and it also making me learn a lot so it's a win win.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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