from datetime import datetime


def str_date_to_date(date_from, date_to):
    """
    Convert two dates in str format to date object
    Format: YYYYMMDD

    :param date_from: beginning of the interval
    :param date_to: end of the interval
    :return: from_date and to_date equivalent of given in date objects
    """
    from_date = datetime.strptime(date_from, "%Y%m%d").date() if date_from is not None else None
    to_date = datetime.strptime(date_to, "%Y%m%d").date() if date_to is not None else None
    return from_date, to_date