mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-25 16:53:42 -04:00
rename which_financial_year to get_financial_year_for_datetime
also fix bug on the very second of rollover, march 31st 23:00:00, and add tests
This commit is contained in:
@@ -63,8 +63,9 @@ def get_current_financial_year_start_year():
|
||||
return financial_year_start
|
||||
|
||||
|
||||
def which_financial_year(start_date):
|
||||
if start_date <= get_april_fools(int(start_date.strftime('%Y'))):
|
||||
return int(start_date.strftime('%Y')) - 1
|
||||
def get_financial_year_for_datetime(start_date):
|
||||
year = int(start_date.strftime('%Y'))
|
||||
if start_date < get_april_fools(year):
|
||||
return year - 1
|
||||
else:
|
||||
return int(start_date.strftime('%Y'))
|
||||
return year
|
||||
|
||||
Reference in New Issue
Block a user