Microservices,Timestamp

First and foremost here is my repl link:
https://boilerplate-project-timestamp.empathetic-otak.repl.co

Everytime I enter unix code to test my api it doesn’t work. It returns “unix: null”.
So that doesnt pass the automatic checking. Same with the last two tests for the timestamp. It fails all 3 of these and I dont know why. I would very much appreciate help. Here is my code incase it is needed:

app.get("/api/:date", function(req, res) {
  const date = new Date(req.params.date);
  const not_nan_date = (!isNaN(Number(date)))
  const date_fr_unix = new Date(date).getTime()
  
  const utc_for_long_num = new Date(Number(date)).toUTCString()

  if(not_nan_date && date.length > 10){
    res.json({ "unix": date_fr_unix, "utc": utc_for_long_num})
  }
  
  
  if(date.toUTCString() !== "Invalid Date"){
    res.json({ "unix": date.getTime(), "utc": date.toUTCString()});
  } else{
    res.json({ error: "Invalid Date"});
  }
});

First, your link is to the live project and not the code. Share the link to the code. If you add code directly, use the</> button in the post editor to put it in code blocks.

Second, check the browser console and server console for errors. When I ran the tests against your project, I saw errors in my browser console like

frame-runner.ts:134 Error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /api</pre>
</body>
</html>

meaning that you don’t have a route to /api (no parameters) like is required by the spec.

Third, to debug you should log your route inputs and outputs for your routes. If I do that to your one route the output is

req.body: undefined
req.params: {"date":"2016-12-25"}
req.query: {}
{ unix: 1482624000000, utc: 'Sun, 25 Dec 2016 00:00:00 GMT' }
req.body: undefined
req.params: {"date":"2016-12-25"}
req.query: {}
{ unix: 1482624000000, utc: 'Sun, 25 Dec 2016 00:00:00 GMT' }
req.body: undefined
req.params: {"date":"1451001600000"}
req.query: {}
{ error: 'Invalid Date' }
req.body: undefined
req.params: {"date":"05 October 2011, GMT"}
req.query: {}
{ unix: 1317772800000, utc: 'Wed, 05 Oct 2011 00:00:00 GMT' }
req.body: undefined
req.params: {"date":"this-is-not-a-date"}
req.query: {}
{ error: 'Invalid Date' }

which only covers the tests with parameters, again indicating that the tests have no /api to hit when there are no parameters. Your problems with the unix timestamp are here

req.body: undefined
req.params: {"date":"1451001600000"}
req.query: {}
{ error: 'Invalid Date' }

which means you are not checking for a string of numbers that won’t parse as a valid date but will parse as a unix timestamp properly and are hitting your error return.

Thanks so much here. I will deconstruct what you said and see what I can do!