Spaces:
Runtime error
Runtime error
Update app.py
Browse filesupdates and correction of errors
app.py
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from hijri_converter import Gregorian, Hijri
|
|
|
|
| 4 |
|
| 5 |
# Set the title of the app
|
| 6 |
st.title("Date Converter with Deadlines")
|
| 7 |
|
| 8 |
-
# Add a sidebar with
|
| 9 |
st.sidebar.title("Navigation")
|
| 10 |
-
option = st.sidebar.
|
| 11 |
"Choose an option",
|
| 12 |
("Three Month Deadlines", "60 Days Deadlines")
|
| 13 |
)
|
|
@@ -100,9 +101,9 @@ def sixty_days_deadlines():
|
|
| 100 |
|
| 101 |
# Convert the selected Gregorian date to a Hijri date
|
| 102 |
if year and month and day:
|
| 103 |
-
#
|
| 104 |
-
gregorian_date =
|
| 105 |
-
hijri_date = gregorian_date.to_hijri()
|
| 106 |
|
| 107 |
# Add chosen start date to the data list
|
| 108 |
date_data.append({
|
|
@@ -112,8 +113,8 @@ def sixty_days_deadlines():
|
|
| 112 |
})
|
| 113 |
|
| 114 |
# Calculate and store the deadline (60 days from the start date)
|
| 115 |
-
deadline_gregorian_date = gregorian_date
|
| 116 |
-
deadline_hijri_date = Gregorian
|
| 117 |
|
| 118 |
date_data.append({
|
| 119 |
"Description": "Deadline - 60 days from start date",
|
|
@@ -128,7 +129,7 @@ def sixty_days_deadlines():
|
|
| 128 |
st.write("### Date Conversion Table")
|
| 129 |
st.dataframe(df)
|
| 130 |
|
| 131 |
-
# Sidebar navigation
|
| 132 |
if option == "Three Month Deadlines":
|
| 133 |
three_month_deadlines()
|
| 134 |
elif option == "60 Days Deadlines":
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from hijri_converter import Gregorian, Hijri
|
| 4 |
+
from datetime import date, timedelta
|
| 5 |
|
| 6 |
# Set the title of the app
|
| 7 |
st.title("Date Converter with Deadlines")
|
| 8 |
|
| 9 |
+
# Add a sidebar with radio buttons
|
| 10 |
st.sidebar.title("Navigation")
|
| 11 |
+
option = st.sidebar.radio(
|
| 12 |
"Choose an option",
|
| 13 |
("Three Month Deadlines", "60 Days Deadlines")
|
| 14 |
)
|
|
|
|
| 101 |
|
| 102 |
# Convert the selected Gregorian date to a Hijri date
|
| 103 |
if year and month and day:
|
| 104 |
+
# Create a Gregorian date from user input
|
| 105 |
+
gregorian_date = date(year, month, day)
|
| 106 |
+
hijri_date = Gregorian(gregorian_date.year, gregorian_date.month, gregorian_date.day).to_hijri()
|
| 107 |
|
| 108 |
# Add chosen start date to the data list
|
| 109 |
date_data.append({
|
|
|
|
| 113 |
})
|
| 114 |
|
| 115 |
# Calculate and store the deadline (60 days from the start date)
|
| 116 |
+
deadline_gregorian_date = gregorian_date + timedelta(days=60)
|
| 117 |
+
deadline_hijri_date = Gregorian(deadline_gregorian_date.year, deadline_gregorian_date.month, deadline_gregorian_date.day).to_hijri()
|
| 118 |
|
| 119 |
date_data.append({
|
| 120 |
"Description": "Deadline - 60 days from start date",
|
|
|
|
| 129 |
st.write("### Date Conversion Table")
|
| 130 |
st.dataframe(df)
|
| 131 |
|
| 132 |
+
# Sidebar navigation using radio buttons
|
| 133 |
if option == "Three Month Deadlines":
|
| 134 |
three_month_deadlines()
|
| 135 |
elif option == "60 Days Deadlines":
|