Actions
Activity #2566
closedModule #2559: Dashboard - Analytics
Sub module #2560: Development for Level 0 (State level default)
Sub module #2562: Development of database functions
Implement logic to determine the appropriate axis range (date, month, year) from input date range
Start date:
05/19/2024
Due date:
05/21/2024
% Done:
100%
Estimated time:
Planned Due Date:
Description
determine_axis_range(start_date, end_date):
# Convert the input dates to datetime objects
start_date = datetime.strptime(start_date, "%Y-%m-%d")
end_date = datetime.strptime(end_date, "%Y-%m-%d")
- Calculate the difference in days between the start and end dates
delta = end_date - start_date
days_diff = delta.days
- Determine the appropriate axis range based on the number of days
if days_diff < 31:
return "date" # Less than a month
elif days_diff < 365:
return "month" # Less than a year
else:
return "year" # A year or more
Actions