Tell us what’s happening:
Im getting below error
It should return the expected error message for an invalid date

Your code so far

pp.get("/api/timestamp/", (req, res) => {
res.json({ unix: Date.now(), utc: Date() });

app.get("/api/timestamp/:date_string", (req, res) => {
let dateString = req.params.date_string;

if (/\d{5,}/.test(dateString)) {
let dateInt = parseInt(dateString);
res.json({ unix: dateString, utc: new Date(dateInt).toUTCString() });
let dateObject = new Date(dateString);
if (dateObject.toString() === “Invalid Date”) {
res.json({“unix”: dateObject.getTime(), “utc” : dateObject.toString()});
} else {
res.json({ unix: dateObject.getTime(), utc: dateObject.toUTCString() });

Your browser information:

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

Challenge: undefined

Link to the challenge:

Hello. can you please add your code into a code block to make it easier to read?

also Line 1 is pp.get:slight_smile: