Exercise Tracker test broken for date to be string

Tell us what’s happening:

Unable to pass this test for Exercise tracker microservices even though all of my data is perfect

The date property of any object in the log array that is returned from GET /api/users/:id/logs should be a string… Use the dateString format of the Date API.

Please help

Your project link(s)

solution: https://replit.com/@ankitkandari/freecodecamp-exercisetracker

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36

Challenge: Exercise Tracker

Link to the challenge:

It’s currently working. See the other posts on this issue for details about the time zone offset issue with this test. If that is the only problem, the the test should pass when your local data and the UTC date are the same (the two dates were the same when I checked your project).

1 Like

Thankyou so much @jeremy.a.gray For your reply.I am glad to tell you that
I was able to pass the remaining test for my project today without touching a single line of code,might be a glitch at freecodecamp test codebase.

Thankyou again

Nope, not a glitch so much as the wrong data structure. It’s because the project uses plain dates and not timestamps. The dates are just Date() equivalents of 2022-01-09, with no timezone information. Upon conversion to a Date() object, the date is assumed to be local time, and then converted to midnight local time, in UTC. So for me, that means that from 6 PM to midnight, my tests on this project will fail since I’m in US Central Time and the local date is not the same as the UTC date for those 6 hours.

The straightforward fix is to store the dates as timestamps but that would require some reworking of the project, the requirements, and the tests.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.