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 = []
res.push(date.toISOString().substring(0,10))
let op = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
res.push(date.toLocaleDateString("en-us", op))
return res;
}
console.log(getDateFormats())
  **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!

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