Back End Development and APIs Projects - Timestamp Microservice -

Everything works as expected but failing:

Your project can handle dates that can be successfully parsed by new Date(date_string)

Here is a link to replit project:

I’ve looked all over and seems a lot of people having issues with this. As far as I can work out surely if I change user input (in either of the 2 formats) to a valid JS Date and check if is parsed successfully by passing to Date.parse() it should pass the test?

It all works as expected as far as I can see, although after running tests I get all sorts of errors in console. The first one being the regex match(). I only added that as an extra check really to check if in date format “2015-12-12” sort of thing.

Can anyone give me any hints as to where I am going wrong please?

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Back End Development and APIs Projects - Timestamp Microservice

Link to the challenge:

Your code or link did not post.

That’s probably the problem as all valid dates don’t match the 2015-12-12 pattern. One of the dates tested is 05 October 2010 or some such and most projects fail there because they don’t consider all the formats that new Date(date_string) can handle. See the documentation and pay particular attention to the parts involving Invalid Date.

Finally, log all the route inputs and route responses and as much of what happens in between to see what the tests send to the route as input and what (and why) the route sends in response.

1 Like

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