Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Brian Mickey
Brian Mickey
2,014 Points

JS Basics Doing Math Time Calculator gives you 52 weeks * 7 days = 364 days a year

In the Time Calculator exercise you are doing math based on 60 seconds per minute, 60 minutes per hour, 24 hours per day, 7 days per week, 52 weeks per year.

If you multiply 52 weeks by 7 days, you get 364 days per year.

I know this is a simple exercise to teach how to use JS to do the math, but breaking down a year this way will give you technically wrong answers (if you start measuring in years). There are 365 days a year plus an extra day for leap years (Google says 365.242199 days in a year to be super technical).

This just bugged me, and I wanted to point out that if you plan to do any sort of calculations involving days and years in this way you need to start with more accurate numbers to get an accurate result.