Project exercise Tracker not getting passed even though I have complete all tasks

I have complete all the requirement to get passed the exercise tracker project. even though I’m still not getting passed following task. I have no idea why?

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

my project live link
my project link

Please help. :cry: :disappointed:

Submitting an existing username doesn’t work.

Thanks! I made it work. but still not getting passed :frowning_face:

I had a similar problem yesterday. Passing all tests except this one. I did use toDateString() and couldn’t find the problem. Made some random “improvements / (fixed a typo)” and suddenly it passed. Not sure this is importent: Submitting an existing username creates a new user (with the same username) (as in the demo); in the database the dates also have the dateString format.

in the exercise tracker I m not getting passed following 2 tasks.

  1. The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added

  2. 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.

but all two tasks I have completely done. you can check it below links. why is that? can someone help me on this?

my live site link

my project link


Can you try using toDateString instead of toLocaleDateString, I think the format might be wrong.

This is the expected format:

date: 'Mon Jan 01 1990'

This is your response:

{"_id":"617ea1debb84b8d5d29264be","username":"fcc_test_16356889264","description":"test","duration":60,"date":"Mon, Jan 1, 1990"}

When I look at the response from the logs endpoint I see this (note the date).

{"_id":"617ea1ebbb84b8d5d29264d1","username":"fcc_test_16356889397","count":1,"log":[{"description":"test","duration":60,"_id":"617ea1edbb84b8d5d29264d3","date":"Invalid Date"}]}

I think your logic for handling empty dates is likely not correct.

it helped me passed first one. still fails following one. As you said i changed it to todatestring(). I changed the way of handling the empty dates too

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 do not create duplicate topics. I have merged your threads.

You can post in your own thread to bump it up, just don’t do it too often and be patient.

Open the dev tool in the browser and when submitting look at the response object you are sending back for the exercises and logs endpoints. Look at the date.


{"_id":"61816e02f45465c8f2984ba9","username":"fcc_test_16358722563","description":"test","duration":60,"date":"Invalid Date"}


{"_id":"61816e02f45465c8f2984ba9","username":"fcc_test_16358722563","count":1,"log":[{"description":"test","duration":60,"date":"Invalid Date"}]}

Log out and make sure your logic for handling empty dates is sound. Before you were checking for an empty string, now you are checking for null. Are you sure that will work?

1 Like

Yes it works. and it gives me the current date too by using null.
I get following response by using that way. as per today(nov-04-2021).

exercise : -

{"_id":"6183867403bd2be769e2d8ac","username":"dion","description":"dancing","duration":45,"date":"Thu Nov 04 2021"}


{"_id":"6183867403bd2be769e2d8ac","username":"dion","count":1,"log":[{"description":"dancing","duration":45,"date":"Thu Nov 04 2021"}]}

Your project isn’t running for me.

You say it works but unless I’m missing something it really shouldn’t for the missing date requirment.

  1. Log out and tell me what type you see when no date is provided?

  2. Log out the new document after you have created one. What happens when you create a document where one of the property values is using the type you logged above?

  3. Log out inside the null check if statement, are you sure you are entering it when you expect to?

Just in case I’m being too vague should be undefined when no date is provided. Passing an undefined value to the document constructor for one of the properties should result in that property missing from the document. Accessing a missing property should return undefined. At no point should the property exist with a null value (as far as I can tell).

1 Like

I tried with undefined. but with undefined I’m not getting the current date. date I get is jan 01 1970 :disappointed:

I think something wrong from my end. undefined works. it doesnt seems work for me. so i didnt try submitting it. I guess somthing wrong with my browser. sorry for the bother. thank you so much! :blue_heart:

It is not your browser, you are just not handling the missing date correctly. Maybe I just didn’t explain it well enough.

You can not set one of the document properties to undefined, if you do that it will not get created and will be missing in the document. Check before you create the document and handle the missing date. Then add the date you create manually to the document.

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