parent
14133f591c
commit
760ebc6980
|
@ -181,6 +181,22 @@ def next_economist(input_date: date) -> date:
|
|||
return next_thursday_date
|
||||
|
||||
|
||||
def uk_financial_year_end(input_date: date) -> date:
|
||||
"""Next date of the end of the UK financial year, April 5th."""
|
||||
# Determine the year of the input date
|
||||
year = input_date.year
|
||||
|
||||
# Calculate the UK financial year end date (April 5th)
|
||||
uk_financial_year_end = date(year, 4, 5)
|
||||
|
||||
# If the input date is on or after the UK financial year end date,
|
||||
# move to the next year
|
||||
if input_date > uk_financial_year_end:
|
||||
uk_financial_year_end = date(year + 1, 4, 5)
|
||||
|
||||
return uk_financial_year_end
|
||||
|
||||
|
||||
def timedelta_display(delta: timedelta) -> str:
|
||||
"""Format timedelta as a human readable string."""
|
||||
total_seconds = int(delta.total_seconds())
|
||||
|
@ -259,6 +275,7 @@ def get_data() -> dict[str, str | object]:
|
|||
"us_clock_change": get_next_timezone_transition("America/New_York"),
|
||||
"mothers_day": next_uk_mothers_day(today),
|
||||
"fathers_day": next_uk_fathers_day(today),
|
||||
"uk_financial_year_end": uk_financial_year_end(today),
|
||||
}
|
||||
|
||||
return reply
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
{{days(fathers_day)}}
|
||||
{{fathers_day.strftime("%a, %d %b %Y")}}</li>
|
||||
|
||||
<li>End of financial year:
|
||||
{{days(uk_financial_year_end)}}
|
||||
{{uk_financial_year_end.strftime("%a, %d %b %Y")}}</li>
|
||||
|
||||
<li>UK bank holiday:
|
||||
{{days(bank_holiday["date"])}}
|
||||
{{bank_holiday["date"].strftime("%a, %d %b")}}
|
||||
|
|
Loading…
Reference in a new issue