I am stuck with the last test of Exercise Tracker from Freecodecamp backend certification test.
“You can add
limit parameters to a
GET /api/users/:_id/logs request to retrieve part of the log of any user.
to are dates in
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:
May someone enlighten me what’s wrong in here?
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.
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.
Solution: I move my replit code into codesandbox, and it pass!
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" )