Tell us what’s happening:
Describe your issue in detail here.
empty date constraint is failing
Your project link(s)
solution: https://vishvtimestamp.herokuapp.com
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Challenge: Timestamp Microservice
Link to the challenge:
Your code is passing for me.
When asking for help, please post your code. Or a link to your repo, or a Replit.
app.get("/api/:date?",(req,res)=>{
var da=req.params.date;
let d;
if(!da){
d=new Date();
}
else{
d=new Date(da);
if(isNaN(d)){
d=new Date(parseInt(da))
}
}
if(isNaN(d)){
res.json({
error : “Invalid Date”
})
}
else{
res.json({
unix:d.getTime(),
utc:d.toUTCString()
});
}}
)
for me empty parameter case is passing on localhost but not on public url
system
Closed
5
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.