APIs and Microservices Projects - Timestamp - errorMicroservice

Tell us what’s happening:
My 2 tests below are not passing :

  1. An empty date parameter should return the current time in a JSON object with a ‘unix’ key.

  2. An empty date parameter should return the current time in a JSON object with a ‘utc’ key

Your code so far
Please find the code here

app.get("/api/timestamp", (req, res)=>{
  let date = new Date();
  
  return res.json({
    'unix': date.getTime(), 
    'utc': date.toUTCString()
  });  
});

app.get("/api/timestamp/:date", (req, res)=>{
  let resultDate='';

  let inputDate = new Date(req.params.date);

  if(inputDate.toString() == "Invalid Date"){
    //convert from unix date to normal date
    inputDate = new Date(parseInt(req.params.date));
    // console.log(inputDate, "Invalid Date");
  }
 
  if(inputDate.toString() == "Invalid Date") {
    return res.json({error: "Invalid Date"});
  } else {
    resultDate = { unix: inputDate.getTime(), 
    utc: inputDate.toUTCString() };
    // console.log(resultDate);
  }
  return res.json(resultDate);
});

Your browser information:

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

Challenge: Timestamp Microservice

Link to the challenge: