Prevent invalid dates from getting through