mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 16:23:44 -04:00
reformat
This commit is contained in:
@@ -3,9 +3,9 @@ from datetime import date, datetime, time, timedelta
|
||||
|
||||
def get_months_for_financial_year(year):
|
||||
return [
|
||||
month for month in (
|
||||
get_months_for_year(4, 13, year)
|
||||
+ get_months_for_year(1, 4, year + 1)
|
||||
month
|
||||
for month in (
|
||||
get_months_for_year(4, 13, year) + get_months_for_year(1, 4, year + 1)
|
||||
)
|
||||
if month < datetime.now()
|
||||
]
|
||||
@@ -22,15 +22,12 @@ def get_calendar_year(year):
|
||||
def get_calendar_year_dates(year):
|
||||
year_start_datetime, year_end_datetime = get_calendar_year(year)
|
||||
|
||||
return (
|
||||
year_start_datetime.date(),
|
||||
year_end_datetime.date()
|
||||
)
|
||||
return (year_start_datetime.date(), year_end_datetime.date())
|
||||
|
||||
|
||||
def get_current_calendar_year():
|
||||
now = datetime.utcnow()
|
||||
current_year = int(now.strftime('%Y'))
|
||||
current_year = int(now.strftime("%Y"))
|
||||
year = current_year
|
||||
return get_calendar_year(year)
|
||||
|
||||
@@ -41,11 +38,12 @@ def get_new_years(year):
|
||||
|
||||
def get_month_start_and_end_date_in_utc(month_year):
|
||||
"""
|
||||
This function return the start and date of the month_year as UTC,
|
||||
:param month_year: the datetime to calculate the start and end date for that month
|
||||
:return: start_date, end_date, month
|
||||
This function return the start and date of the month_year as UTC,
|
||||
:param month_year: the datetime to calculate the start and end date for that month
|
||||
:return: start_date, end_date, month
|
||||
"""
|
||||
import calendar
|
||||
|
||||
_, num_days = calendar.monthrange(month_year.year, month_year.month)
|
||||
first_day = datetime(month_year.year, month_year.month, 1, 0, 0, 0)
|
||||
last_day = datetime(month_year.year, month_year.month, num_days, 23, 59, 59, 99999)
|
||||
@@ -65,7 +63,7 @@ def get_calendar_year_for_datetime(start_date):
|
||||
if type(start_date) == date:
|
||||
start_date = datetime.combine(start_date, time.min)
|
||||
|
||||
year = int(start_date.strftime('%Y'))
|
||||
year = int(start_date.strftime("%Y"))
|
||||
if start_date < get_new_years(year):
|
||||
return year - 1
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user