Add helper to get months for a financial year:

* No tests have been added as this was taken from the admin
  where it is already tested thoroughly.
* TODO: Move to utils
This commit is contained in:
Imdad Ahad
2017-08-18 12:45:05 +01:00
parent 953e2ae5bd
commit 2371c2c9a7

View File

@@ -5,6 +5,20 @@ import pytz
from app.utils import convert_bst_to_utc
def get_months_for_financial_year(year):
return [
convert_bst_to_utc(month) for month in (
get_months_for_year(4, 13, year) +
get_months_for_year(1, 4, year + 1)
)
if month < datetime.now()
]
def get_months_for_year(start, end, year):
return [datetime(year, month, 1) for month in range(start, end)]
def get_financial_year(year):
return get_april_fools(year), get_april_fools(year + 1) - timedelta(microseconds=1)