#5 Created ability to generate views for a given product from the past X days

This commit is contained in:
2024-02-05 23:19:39 +00:00
parent ee33965baf
commit 3a08686fc3
3 changed files with 34 additions and 1 deletions

8
utils/general_utils.py Normal file
View File

@ -0,0 +1,8 @@
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