Fixing validity check on date input