(date_str)
return dateutil_parser.parse(date_str).date()
Casts a date string as a datetime.date, or None if it is blank.

    >>> as_date_or_none('2020-11-04')
    datetime.date(2020, 11, 4)
    >>> as_date_or_none('')
    None
    >>> as_date_or_none(None)
    None
Casts a date string as a datetime.date, or None if it is blank.
Casts a date string as a datetime . date or None if it is blank .
def as_date_or_none(date_str):
    """
    Casts a date string as a datetime.date, or None if it is blank.

    >>> as_date_or_none('2020-11-04')
    datetime.date(2020, 11, 4)
    >>> as_date_or_none('')
    None
    >>> as_date_or_none(None)
    None

    """
    if not date_str:
        return None
    return dateutil_parser.parse(date_str).date()
def as_date_or_none ( date_str ) : if not date_str : return None return dateutil_parser . parse ( date_str ) . date ( )