Backend project 1: Timestamp

Hi!
So I’m working on the timestamp microservice project and i’m getting this error If the input date string is invalid, the api returns an object having the structure { error : "Invalid Date" } altough the response is what the test is asking for. Maybe there is an error in my code but i didn’t figure out where. Here is a link to my code: https://boilerplate-project-timestamp.redouane1.repl.co

You need to log your inputs and outputs and you’ll see

req.body: undefined
req.params: {"date":"this-is-not-a-date"}
req.query: {}
{ unix: NaN, utc: 'Invalid Date' }

The tests expect {"error": "Invalid Date"}. The invalid date is matching your last condition since it contains a -.

1 Like