The responseObj object is never reinitialized. So whatever is set remains between calls to the route. Which may make debugging harder.
Your try/catch in the timestampRegex.test(req.params.date) if/else is masking an error. Remove it and look at the console. When the date is the unix string you have to convert it to a number before passing it to new Date().
new Date(1451001600000);
// Fri Dec 25 2015 01:00:00 GMT+0100 (Central European Standard Time)
new Date('1451001600000');
// Invalid Date
You are not handling the “05 October 2011, GMT” param string correctly. It may be easier to just use includes and look for a dash or a space date.includes('-') || date.includes(' ').
Hi
First, thanks for your reply!
For the date handling, I’m not sure if includes can handle all date formats but I will try.
For the timestamp, I tried to convert it but still the same problem and I
really couldn’t figure out why