from datetime import datetime def is_within_x_days(date: datetime, x_days: float = 7): """ Returns true if the date is within X days """ current_date = datetime.now() difference = current_date - date return abs(difference.days) <= x_days