Timestamp microservice

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 date

my 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

hi, here’s the link to my project:
https://boilerplate-project-timestamp-1.alexeylozin.repl.co

oh, maybe this link will work:

boilerplate-project-timestamp-1 - Replit

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