Stuck in last condition with Your project can handle dates that can be successfully parsed by new Date(date_string)

Tell us what’s happening:
It says: Your project can handle dates that can be successfully parsed by new Date(date_string)

Can you tell me what am I doing wrong?

Your code so far

app.get('/api/timestamp/:date?', (req, res) => {
  const { date } = req.params;

  const dateObj = typeof date == 'undefined' ? new Date() : date.indexOf('-') == -1 ? new Date(parseInt(date)) : new Date(date);

  if (dateObj != 'Invalid Date') {
    const unix = dateObj.getTime();
    const utc = dateObj.toUTCString();
    res.json({
      unix,
      utc
    });
  } else {
    res.json({
      error: "Invalid Date"
    })
  }
});

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.88 Safari/537.36.

Challenge: Timestamp Microservice

Link to the challenge:

This should help you.