Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
floating-io
· 2y ago · 0 comments
Of course, if you’re going to constrain your data, make sure your constraints are actually correct…
case February => assert(value >= 1 && value <= 28)
Last time I checked, 2024 is a leap year, so Feb 29 is valid…
Comments
[–]
awwsmm
2y ago
Nice work! Now solve the other problem at the end of the article
[–]
lilyball
2y ago
Is it the fact that you can still mark the DOB as a day later in the current year, which would make age negative?
[–]
awwsmm
2y ago
That's another flaw in that model, definitely.