#5 Created ability to generate views for a given product from the past X days
This commit is contained in:
8
utils/general_utils.py
Normal file
8
utils/general_utils.py
Normal 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
|
Reference in New Issue
Block a user