Minor change in instructions

Tell us what’s happening:


I could see while doing the small timestamp app that in the instructions, the error message to be displayed is the following: {unix": null, "utc": "Invalid Date"}, however, when running testing and verifying the proposed solution, I could notice that the following error message is really required: {error: "Invalid Date"}.

I think it would be good to be able to make that correction in the instructions for all those who perform the exercise.

Your code so far

const unixRegex = /\d{5,}/;

app.get("/api/timestamp", (req, res) => {
  const now = new Date();

  res.json({ unix: now.getTime(), utc: now.toUTCString() });

app.get("/api/timestamp/:date_string", (req, res) => {
  const dateString = req.params.date_string;
  if (unixRegex.test(dateString)) {
    const validDate = new Date(parseInt(dateString));
    res.json({ unix: validDate.getTime(), utc: validDate.toUTCString() });
  const validDate = new Date(dateString);
  if (validDate.toString() === "Invalid Date") {
    res.json({ error: "Invalid Date" });
  } else {
    res.json({ unix: validDate.getTime(), utc: validDate.toUTCString() });

Your browser information:

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

Challenge: APIs and Microservices Projects - Timestamp Microservice

Link to the challenge: