from datetime import datetime, timedelta | |
import calendar | |
def get_current_month_range(): | |
"""Helper function to get the first and last dates of the current month.""" | |
now = datetime.now() | |
start_of_month = datetime(now.year, now.month, 1) | |
_, last_day = calendar.monthrange(now.year, now.month) | |
end_of_month = datetime(now.year, now.month, last_day, 23, 59, 59) | |
return start_of_month, end_of_month | |