code: def parse_date(value: Union[date, StrIntFloat]) -> date:
      
      if isinstance(value, date):
          if isinstance(value, datetime):
              return value.date()
          else:
              return value
  
      number = get_numeric(value)
      if number is not None:
          return from_unix_seconds(number).date()
  
      match = date_re.match(cast(str, value))
      if not match:
          raise errors.DateError()
  
      kw = {k: int(v) for k, v in match.groupdict().items()}
  
      with change_exception(errors.DateError, ValueError):
          return date(**kw)
docs: Parse a date/int/float/string and return a datetime.date.
  
      Raise ValueError if the input is well formatted but not a valid date.
      Raise ValueError if the input isn't well formatted.