Hi,
I am having a difficult time passing the Timestamp Microservice. if anyone can help feel free to message me.
// your first API endpoint…
app.get("/api/timestamp/:timestamp", function (req, res) {
let timestamp = req.params.timestamp;
if(timestamp.match(/\d{5,}/)){
timestamp = +timestamp;
}
let date = new Date(timestamp);
if(date.toUTCString == "Invalid Date"){
res.json({error: date.toUTCString()})
}
res.json({unix: date.valueOf(), utc: date.toUTCString() });
});
app.get("/api/timestamp/", (req, res) => {
let date = new Date();
res.json({ unix: date.valueOf(), utc: date.toUTCString() });
})
Tell us what’s happening:
Your project link(s)
solution: https://slow-plaid-monarch.glitch.me
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36
.
Challenge: Timestamp Microservice
Link to the challenge: