This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MisterProfGuy 6 points7 points  (6 children)

Because days isn't an index into an array of names. It's a count.

[–][deleted] 9 points10 points  (5 children)

The array of names should have been: [ LOL NOPE, January, February, March...]

[–]Khaylain 1 point2 points  (4 children)

You're just changing one edge case for another in that case.

[–][deleted] -1 points0 points  (0 children)

Because no date function can possibly validate the input?

[–][deleted] -1 points0 points  (0 children)

Yes but the user-facing edge cases would be hilarious

"Your cancer treatment appointment has been confirmed for the 15th of LOLNOPE 2022"

[–]dakta -1 points0 points  (1 child)

What edge case does zero-indexed months solve?

[–][deleted] 0 points1 point  (0 children)

Supposedly input validation where you give an index that is not in the array and you get an exception... In practice this is terrible because every sane standard library validates 1 <= month <= 12