+ 2
Day of the Week Test Case #3 keeps failing, any suggestions?
3 Respostas
+ 3
I know this is not too helpful, but I checked your solution and I think it's a good one, taking advantage of the Java time API. I would solve it in a similar way (I haven't tried yet). But I have no idea about the hidden case. It could be a bug in the task itself, but obviously we cannot confirm it. If others don't come up with a reasonable explanation, it might be worth reporting this to Sololearn so they double check on it.
+ 3
Hello Javan,
Firstly, the hidden test case #3 input is: January 1, 1990
The reason your code fails is that you are using 'dd' as the pattern. Both 'MM' and 'dd' require zero padding, so your code would work for dates 01, 02 etc but not 1, 2 etc.
Easy fix, is to change ln17:
.appendPattern("MMMM dd, yyyy")
to:
.appendPattern("MMMM d, yyyy")
ps. nice work :D
+ 3
Thank you so much DavX
Much appreciated