Back End Development and APIs Projects - Timestamp Microservice

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

Your browser information:

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

Challenge: Back End Development and APIs Projects - Timestamp Microservice

Link to the challenge:

Hi everyone, I am trying to solve the timestamp project in Replit. The code works fine, it does everything it has to do but freeCodeCamp does not approve these items:

Also in the Replit console I get the following errors:

Screenshot error in timestamp boilerplate

And here I leave the link to my project.

I would appreciate if someone can help me because I have tried everything but it does not work for me.

Thank you very much.

The header error is caused by having multiple res’s inside the same route/handler without a return. If you add a return to them it should go away.

There is usually no harm in always having a return.

Even if this works, it is a questionable use of coercion. Check for what the Date constructor actually returns when provided with undefined or just a truthy check when applicable. I would also call the Date constructor before the logic and save the return, then reuse that value in the rest of the code. There is no need to keep calling the constructor.

if (new Date(inputDate) > 0)


inputDatee = parseInt(inputDate);

This else is when is undefined. How can you use inputDate here? This is the case for the current time.

else {
  inputDatee = parseInt(inputDate);
  answerObj["unix"] = new Date(inputDate).getTime();
  answerObj["utc"] = new Date(inputDate).toUTCString();

Thank you very much for your help. After changing the code and testing the live view several times I realized that the problem could be the time zone in which I am, which is different from the one that accepts the project as correct. To fix it, I changed the time on my computer so I could approve the project.

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