Date Validation (check user age)
I’m going to admit now that I have issues with validating date formats. Not so much the format itself, but finding whether user x is a certain age. Working on some alcohol projects in the past, it has caused a bit of pain whichever language. The main issue comes from trying to see a date as a number. In C# it is quite easy (I will write a separate post on this eventually), but in javascript I found it a bit fiddly.
Why would one use Javascript to check for age? Facebook! Facebook apps reply on Javascript for validation etc. So after looking round the internets, I found this useful function:
Still fiddly, but it works. Enjoy. Any feedback welcome as usual.