It is the problem. Your regex makes your if statement condition false for the date I posted which is what is tested against.
const date = '05 October 2011'
const regex = /\d\d\d\d-\d\d-\d\d/g;
console.log(regex.test(date)); // false
Your code:
if (regex.test(req.rawdatepara)) {
req.date = new Date(req.rawdatepara);
} else {
let date = new Date(req.rawdatepara * 1).toUTCString();
req.date = new Date(date);
}
When I fix that in your code I pass all the tests. I just used includes but you can use a regex as well.