James McCool commited on
Commit
b9e7e41
·
1 Parent(s): ba685f6

Refactor date input handling in app.py to improve date selection logic. Updated date filtering to ensure proper date formatting and consistency, allowing for seamless selection of date ranges including a "Last Year" option. This enhances user experience and data analysis capabilities.

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -37,23 +37,23 @@ with st.sidebar:
37
  )
38
 
39
  if date_filter == "Last Year":
40
- end_date = max_date.date()
41
- start_date = (end_date - timedelta(days=365)).date()
42
  else:
43
  col1, col2 = st.columns(2)
44
  with col1:
45
  start_date = st.date_input(
46
  "Start Date",
47
- value=(max_date - timedelta(days=365)).date(),
48
- min_value=min_date.date(),
49
- max_value=max_date.date()
50
  )
51
  with col2:
52
  end_date = st.date_input(
53
  "End Date",
54
- value=max_date.date(),
55
- min_value=min_date.date(),
56
- max_value=max_date.date()
57
  )
58
 
59
  selected_team = st.selectbox(
 
37
  )
38
 
39
  if date_filter == "Last Year":
40
+ end_date = max_date
41
+ start_date = (end_date - timedelta(days=365))
42
  else:
43
  col1, col2 = st.columns(2)
44
  with col1:
45
  start_date = st.date_input(
46
  "Start Date",
47
+ value=(max_date - timedelta(days=365)),
48
+ min_value=min_date,
49
+ max_value=max_date
50
  )
51
  with col2:
52
  end_date = st.date_input(
53
  "End Date",
54
+ value=max_date,
55
+ min_value=min_date,
56
+ max_value=max_date
57
  )
58
 
59
  selected_team = st.selectbox(