Update calendar_app.py
Browse files- calendar_app.py +7 -2
calendar_app.py
CHANGED
|
@@ -33,7 +33,12 @@ class Calendar:
|
|
| 33 |
|
| 34 |
def add_daterange(self, date_start, date_end, reminder):
|
| 35 |
"""Add a reminder for a date range."""
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
if str(date) not in self.reminders:
|
| 38 |
self.reminders[str(date)] = []
|
| 39 |
self.reminders[str(date)].append(reminder)
|
|
@@ -102,7 +107,7 @@ if __name__ == "__main__":
|
|
| 102 |
while True:
|
| 103 |
print("\nCalendar Menu:")
|
| 104 |
print("1. Add Reminder for 1 day")
|
| 105 |
-
print("2. Add Reminder for date range (including weekends)")
|
| 106 |
print("3. Show All Past and Future Reminders")
|
| 107 |
print("4. Show All Future Reminders")
|
| 108 |
print("5. Show Reminders for Specific Day")
|
|
|
|
| 33 |
|
| 34 |
def add_daterange(self, date_start, date_end, reminder):
|
| 35 |
"""Add a reminder for a date range."""
|
| 36 |
+
date_yyyymm = date_start[:-2]
|
| 37 |
+
date_start_day = int(date_start[-2:])
|
| 38 |
+
date_end_day = int(date_start[-2:])
|
| 39 |
+
for day_int in range(date_start_day, date_end_day+1):
|
| 40 |
+
day_str = f"{day_int:02d}"
|
| 41 |
+
date = str(date_yyyymm)+day_str
|
| 42 |
if str(date) not in self.reminders:
|
| 43 |
self.reminders[str(date)] = []
|
| 44 |
self.reminders[str(date)].append(reminder)
|
|
|
|
| 107 |
while True:
|
| 108 |
print("\nCalendar Menu:")
|
| 109 |
print("1. Add Reminder for 1 day")
|
| 110 |
+
print("2. Add Reminder for date range (in the same month, including weekends)")
|
| 111 |
print("3. Show All Past and Future Reminders")
|
| 112 |
print("4. Show All Future Reminders")
|
| 113 |
print("5. Show Reminders for Specific Day")
|