The /now endpoint should return a time that is +/- 20 secs from now
tried solutions here and here with the same result.
my guess was that there’s a time zone difference so I tried: ETC/GMT+1, -1, +2, -2 … which didn’t do the trick.
The /now endpoint should return a time that is +/- 20 secs from now
tried solutions here and here with the same result.
my guess was that there’s a time zone difference so I tried: ETC/GMT+1, -1, +2, -2 … which didn’t do the trick.
We need to see your code. Preferably a live version on Replit.
let express = require('express');
let app = express();
app.get(
"/now",
(req, res, next) => {
req.time = new Date().toString();
next();
},
(req, res) => {
res.send({
time: req.time
});
}
);
Your code is passing for me. Although I did see it fail one time with a timeout as well (from running it on Replit).
Where are you running the code from?
Not sure why it is failing for you. Maybe try it locally.
it works locally. Thanks!
(hard code the date as string also works if your’e fast )
I hard-coded the date as string and I passed. I think I got lucky after I have estimated +20 seconds before I click the pass. Thanks for this tip!
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.