from datetime import datetime


def calc_delta_days(d1, d2):
    """Calculate the day difference between datetime objects."""
    if isinstance(d1, datetime) and isinstance(d2, datetime):
        return (d2 - d1).days
    else:
        raise TypeError("d1 and d2 must be datetime.datetime objects")