HELP ME - APIs and Microservices Projects - Timestamp Microservice

I am trying to solve the challenge APIs and Microservices Projects - Timestamp Microservice but when doing the tests 2 of them I can not pass them, the tests are

  • It should handle an empty date parameter, and return the current time in unix format
  • It should handle an empty date parameter, and return the current time in UTC format

I manage to pass all the others just those 2 are the ones I can’t pass this is the league of my code

When I enter your glitch project into the challenge, along with the repository in the package.json, it passes all of the tests. What exactly did you enter in the challenge page? And what browser are you using?

You can put the same url inside the 2 text boxes the link you have to put is as follows

https://practica1-timestamp-microservice.glitch.me/

Very weird… I did that, and those 2 tests didn’t pass… Then, I went to your project page and entered a blank time, and it responded with the current time (like it’s supposed to). Then I went back and retested… and it passed all the tests. Try testing your project, then opening this in a new tab: https://practica1-timestamp-microservice.glitch.me/api/timestam
Then test again.

Thanks, my friend, your help was very good, sorry for My english isn’t very good because I’m learning

You’re all good. I have no idea why that was happening, perhaps a bug with the tests. Either way, glad you’re able to move on.

I have the same problem. Tried your solution but it didn’t work. It’s very frustrating, since this is the only thing I have left to get the Full Stack Cert. I’ve been at it by 2 days already. I thought this place was supposed to be great and instead is one of the buggiest things I’ve come across online. If you can give me any pointers, I’ll be very grateful.

1 Like

@jsilvao hi, sorry to hear you are having trouble. If you go make a new issue in the forum, and post a link to your code, I will take a look at it for you.

@lucassorenson solved it with the help of @ojeytonwilliams at GitHub. The problem was I had the wrong timezone in my computer settings. Thanks you.:smiley:

Ooh what an annoying problem! I’m glad you got it figured out.

How were you able to solve the problem with the timezone. I’m having the same problem

Hello my friend, I can solve the problem uses a redirect with the query string , I put de example

app.get("/api/timestamp/:date_string?", (request, response) => {
  const { date_string = "" } = request.params;
  if (date_string) {
    const VALID = date_string * 1;
    const DATE = (Number.isNaN(VALID)) ? getDate(date_string) : getDate(VALID);
    response.status(200);
    console.log(DATE);
    response.json(DATE);
  } else {
    const { originalUrl } = request;
    const { unix } = getDate();
    response.redirect(301, `${originalUrl}/${unix}`);
  }
});

I solved by adjusting my computer time and date settings. I had more than 20 seconds of from the real time, I also had to change the timezone to my actual timezone.

Thanks man, that worked.

@jsilvao Why would the PC time and date settings have an effect on the API? Isn’t the API isolated by the browser? Or does the browser pull it’s time settings from the PC?

Hi guys,

I have the same problem and I don’t know how to pass.


Hope you can lead me in the right direction.

Thanks.