Timestamp Microservice [ISSUES]

Hello guys!

I have problem with this following part of my code

app.get("/api/timestamp", (req, res)=>{
  res.json({unix:new Date().getTime(), utc:new Date().toUTCString()});
});

I don’t know why i did wrong but the test always fails at this part

// running tests
An empty date parameter should return the current time in a JSON object with a unix key
An empty date parameter should return the current time in a JSON object with a utc key
// tests completed

I been thinking about it a while and didn’t still catch anything. Help me out! Thanks in advance!
Link: https://repl.it/@Birkhoff/boilerplate-project-timestamp#server.js

Hello there,

If it helps, here are the tests: freeCodeCamp/timestamp-microservice.md at master · freeCodeCamp/freeCodeCamp (github.com)

Otherwise, I have seen cases where campers have needed to add an offset to their local time, in order to pass.

When I submit your code, it passes the tests. So, that is why I assume it is a local time issue.

Hope this helps

Thanks! Your info helped a lot.
It was really a time zone problem. I changed my time zone to UTC-08:00 Baja California and set time and timezone automatically on my computer and it worked!

Hi @birkhoff - I’m having the same issue. Please could you confirm where (code, browser, system) and how you changed your time zone?

I’ve tried a couple of methods but still failing these two tests. Thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.