Date Format Challenge in Rosetta code not passing despite fulfilling requirements?

Tell us what’s happening:
I’m recieving the correct output as far as I can tell, and there are no errors in my chrome console. The test still will not pass.
Your code so far

function getDateFormats() {
let date = new Date();
let res = []
let op = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
res.push(date.toLocaleDateString("en-us", op))
return res;
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36.

Challenge: Date format

Link to the challenge:

Your date format is:

[ '2021-03-01', 'Monday, March 1, 2021' ]

When I change it to:

[ '2021-3-1', 'Monday, March 1, 2021' ]

It passes. So, this is a poorly worded challenge because it doesn’t make it clear. True, there are a lot of poorly worded challenges on interviews. And sometimes they are poorly worded on purpose because they want you to think what the problem could be, to think about edge cases and how they might be handled differently.

I’ll ask what people think in the contributors channel.

That fixed it! thanks so much!

I created this PR to clarify the date format expectations of this challenge. Feel free to make any suggestions or comments on the PR.

1 Like