FCC Backend Cert: Exercise Tracker Last Test Fail with Working Code

Dear all,

I am stuck with the last test of Exercise Tracker from Freecodecamp backend certification test.

“You can add from , to and limit parameters to a GET /api/users/:_id/logs request to retrieve part of the log of any user. from and to are dates in yyyy-mm-dd format. limit is an integer of how many logs to send back.”

I have search the root cause with numerous forum about this project, like wrong date format, time zone offset issue, etc, but I don’t think this is the issue here, because my result look fine (as seen in the log screenshot).

Here my replit:
https://replit.com/@Hadipranowo/fcc-nodejs-project-exercisetracker#index.js

May someone enlighten me what’s wrong in here?

Thank you.

image

Your output is fine. On forking and testing, it failed the penultimate test on the log date string due to the timezone offset issue. Fixing the offset issue (or testing when the local date is the same as UTC date) will pass the test.

Hi Jeremy,

Thanks for the reply,
I have tried to change the time to UTC before, but still not working.
Below is the screenshot of toLocaleString() and toUTCString() from new Date() instance, the local is already UTC.

image

Solution: I move my replit code into codesandbox, and it pass!

Explanation:
After through investigation about this case, I found that my issue is not about timezone offset, but because of the replit server itself.

There are other people who experience the same problem like me, the code and output is fine, but doesn’t pass the test, like this thread: Exercise Tracker Project - Stuck on last test (" Test timed out error" )