I have been trying to write code for this project for the entire last week - I am stuck - I don’t understand how we are supposed to get a user’s input - create an input type date or just a link like in the example? if we create an input form for the date - how do I transfer that value to node.js ? if it’s just a link - I can create a variable in index.js file but then again, how can it be invalid or empty?
my index.html is:
Click on the date
some datemy index.js is
app.get(‘/api/:date?’, (req, res) =>{
let s = “12-10-1986”
let unix = new Date(s).getTime();
let utc = new Date(s).toUTCString();
res.json({unix: parseInt(unix), utc: utc});
});
my output is:
{“unix”:534556800000,“utc”:“Wed, 10 Dec 1986 00:00:00 GMT”}
However it passes only the first test