from datetime import datetime


def config_date_to_datetime(date_str):
    """
    Converts a string date from config formatting %Y%m%d to a datetime object.
    """
    if date_str is None:
        return
    return datetime.strptime(date_str, '%Y%m%d')