fix: 🐛 Now shows when today is a bank holiday
This commit is contained in:
@@ -48,9 +48,9 @@ Because we all have that one colleague who keeps asking "How many days till the
|
||||
|
||||
This script does not guarantee:
|
||||
|
||||
That you'll actually take your holiday
|
||||
That the government won't change their mind about holidays
|
||||
That your boss will let you go on holiday
|
||||
* That you'll actually take your holiday
|
||||
* That the government won't change their mind about holidays
|
||||
* That your boss will let you go on holiday
|
||||
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
|
||||
|
||||
@@ -24,13 +24,16 @@ def get_next_bank_holiday(holidays_data):
|
||||
next_holiday = None
|
||||
min_diff = None
|
||||
|
||||
# Process England and Wales holidays (main data source)
|
||||
if "england-and-wales" in holidays_data:
|
||||
if "england-and-wales" not in holidays_data:
|
||||
return None
|
||||
|
||||
for event in holidays_data["england-and-wales"]["events"]:
|
||||
try:
|
||||
# Parse the date string manually since we don't have dateutil
|
||||
holiday_date = datetime.strptime(event["date"], "%Y-%m-%d").date()
|
||||
if holiday_date >= today:
|
||||
|
||||
if holiday_date < today:
|
||||
continue
|
||||
|
||||
diff = (holiday_date - today).days
|
||||
if min_diff is None or diff < min_diff:
|
||||
min_diff = diff
|
||||
|
||||
Reference in New Issue
Block a user