fix checkDate logic