Unable to pass second to last test in**Exercise Tracker** in Back End Development and APIs Projects

Dear all campers,

I stuck with the test
" 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." and cannot pass it.

I used mongoose API to store date data in ‘String’ format with .toDateString() function.

On my browser, everything works fine and output is the same as the project requires.

I didn’t know the reason why this was not work.

Please help me on this issue
Thank you :slight_smile:

Your project link(s)

solution: https://replit.com/@ochamptho/boilerplate-project-exercisetracker-1

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge:

Welcome there,

When I look in the network tab of the devtools, I see a GET to /:id/logs includes an “invalid date”:

The issue is this line in your :_id/exercises route:

if (date == '') {

I suggest you console.log a few requests to debug why.

Hope this helps

1 Like

Thank you for your help, Sky020.

Because of your advice, I found some missing logics that causes this error.

If somebody enter the “Invalid date” (such as ‘abc’, ‘def’), it will store in my mongoDB as “Invalid date” instead of today date.


1 Like

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