Why does this code not pass the 4th test for exercise tracker?

I got this working and it seems like it does everything it is supposed to. response.json looks the same as the example and the array is being saved in my mongodb atlas. Why is this not passing the test :frowning:

  let responseObject = {};
  responseObject["_id"] = req.body.userId;
  User.findById(req.body.userId, (err,data) => {
    if(err) return console.log(err);

    responseObject["username"] = data.username;
    let dateString = "";
    if(req.body.date === ""){
      dateString = new Date().toString();
      dateString = new Date(req.body.date).toString();
    dateString = dateString.split(' ').slice(0,4).join(' ');
    responseObject["date"] = dateString;
    responseObject["duration"] = req.body.duration;
    responseObject["description"] = req.body.description;

    data.log.push({description: req.body.description, duration: req.body.duration, date: responseObject.date.toString()});


Open up Chrome developer console while running the tests.

Information regarding why the test is not passing should be logged on to the console.

If you could tell me, what error you are getting, I can be of better help.

1 Like

Hey I did not see this response. I ended up getting it working, the problem was that FCC wants the duration to be a number and I was giving it a string. Thank you for your help.

1 Like

my duration is already number, but iā€™m still stuck getting the 4th test