Yo,
I got this error : Your project can handle dates that can be successfully parsed by new Date(date_string)
and i don’t really understand the shit happening …
Maybe someone can help …
// server.js
// where your node app starts
// init project
var express = require('express');
var app = express();
// enable CORS (https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)
// so that your API is remotely testable by FCC
var cors = require('cors');
app.use(cors({optionsSuccessStatus: 200})); // some legacy browsers choke on 204
// http://expressjs.com/en/starter/static-files.html
app.use(express.static('public'));
// http://expressjs.com/en/starter/basic-routing.html
app.get("/", function (req, res) {
res.sendFile(__dirname + '/views/index.html');
});
This file has been truncated. show original
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:93.0) Gecko/20100101 Firefox/93.0
Challenge: Timestamp Microservice
Link to the challenge:
Log your route inputs and responses and you’ll see
req.body undefined
req.params {
"date": "05 October 2011"
}
req.query {}
{ error: 'Invalid Date' }
which is not an invalid date.
Okay thanks for you reply !
Looks like req.query is empty, not saying error … But what it should contain ?
I should define it as a var at the start of the (req, res) function ?
Like
var utc = new Date(req.params.date).toUTCString();
Or an other things ?
Okay i saw its when i test it its said invalid date ! will try to solve so, thx
I think i have it ! But cant display it in UTC because doing the error like saying 1 day before the day inputed …
Just all test pass but i cant get my project confirmed solved on freecodecamp, like all test passed but not sending me to the next challenge its strange …
system
Closed
May 11, 2022, 10:09pm
9
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.