Back End Development and APIs Projects - Timestamp Microservice

Tell us what’s happening:
Final 2 tests not passing and unsure what is wrong with the code. Unsure if it is a timezone issue, but even changing computer date/time does not resolve issue.

Your project link(s)

solution: Glitch :・゚✧

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14268.94.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.215 Safari/537.36

Challenge: Back End Development and APIs Projects - Timestamp Microservice

Link to the challenge:

The last 2 tests are about getting a response for the empty date parameter.

Maybe you can have this code block (from your Glitch) at the beginning of the GET handler function (at present it is at the end of the function) - it checks for condition for the last two tests, and sends a response.

  const dateStr = req.params.date;

  if (!dateStr) {
    let current = new Date();
    return res.json({
      "unix": current.getTime(),
      "utc": current.toUTCString()
    });
  }
1 Like