fix: 🐛 Now shows when today is a bank holiday

This commit is contained in:
2025-08-25 09:00:24 +01:00
parent ac830df641
commit a60d558503
2 changed files with 22 additions and 19 deletions
+3 -3
View File
@@ -48,9 +48,9 @@ Because we all have that one colleague who keeps asking "How many days till the
This script does not guarantee: This script does not guarantee:
That you'll actually take your holiday * That you'll actually take your holiday
That the government won't change their mind about holidays * That the government won't change their mind about holidays
That your boss will let you go on holiday * That your boss will let you go on holiday
But it does guarantee that you'll know exactly when the next one is! But it does guarantee that you'll know exactly when the next one is!
Made with ❤️ and ☕ by someone who's definitely going to take their holiday Made with ❤️ and ☕ by someone who's definitely going to take their holiday
+7 -4
View File
@@ -24,13 +24,16 @@ def get_next_bank_holiday(holidays_data):
next_holiday = None next_holiday = None
min_diff = None min_diff = None
# Process England and Wales holidays (main data source) if "england-and-wales" not in holidays_data:
if "england-and-wales" in holidays_data: return None
for event in holidays_data["england-and-wales"]["events"]: for event in holidays_data["england-and-wales"]["events"]:
try: try:
# Parse the date string manually since we don't have dateutil
holiday_date = datetime.strptime(event["date"], "%Y-%m-%d").date() holiday_date = datetime.strptime(event["date"], "%Y-%m-%d").date()
if holiday_date >= today:
if holiday_date < today:
continue
diff = (holiday_date - today).days diff = (holiday_date - today).days
if min_diff is None or diff < min_diff: if min_diff is None or diff < min_diff:
min_diff = diff min_diff = diff