I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
But WHAT can’t you understand? We can’t start explaining the entire history of computers until we get to the part that you don’t understand. What specific instruction do you not understand. Look at the instructions for this project and copy and paste that instruction here and ask what you don’t understand.
And I say this as someone that also had a difficult time transitioning to the API projects - it is a difficult transition. But we can’t help you if we don’t know what the issue is.
Bom Não precisa explicar a teoria de tudo… E se eu estiver te atrapalhando com os seus afazeres e só me ignorar e não responder mais… não pedi ajuda , voce ofereceu. Eu fiz copiei e colei o projeto pronto q você mandou. No replic parece tudo certo mas jogo no projeto não passa.
Tudo bem! Parece q o código que está Jó próprio Fórum que algeum5 postou parece mais coerente…
app.get("/api/timestamp/:date_string", (req, res) => {
let dateString = req.params.date_string;
//A 4 digit number is a valid ISO-8601 for the beginning of that year
//5 digits or more must be a unix time, until we reach a year 10,000 problem
if (/\d{5,}/.test(dateString)) {
let dateInt = parseInt(dateString);
//Date regards numbers as unix timestamps, strings are processed differently
res.json({ unix: dateString, utc: new Date(dateInt).toUTCString() });
} else {
let dateObject = new Date(dateString);
if (dateObject.toString() === "Invalid Date") {
res.json({ error: "Invalid Date" });
} else {
res.json({ unix: dateObject.valueOf(), utc: dateObject.toUTCString() });
}
}
});
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Once again, I can’t tell which replit you are using.
I have spent a lot of time running around the tree trying to get an answer.
Please decide which version of this you want. Your last link was to version 12. But your code seems to be from version 13. But I can’t get that replit to wake up.
Again, I suggest deleting every timestamp replit that is not the one on which you are working.
I don’t want to debug your code out of context. Please provide a link to the code that is the issue. And please make sure it is a replit that can load. Then I can see the code and see how it is failing.