mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-13 08:34:33 -05:00
* Refactored reports to use pregenerated docs instead * Fixed e2e test * Fixed anothr bug * Cleanup * Fixed timezone conversion * Updated ref files * Updated reference files, refreshed ui/ux for report generation. Buttons toggle on and off based on if report exists * Fixed linting errors, removed pytz * Fixed test failure * e2e test fix * Speeding up unit tests * Removed python time library that was causing performance issues with unit tests * Updated poetry lock * Unit test improvements * Made change that ken reccomended
24 lines
577 B
Python
24 lines
577 B
Python
from datetime import datetime
|
|
from zoneinfo import ZoneInfo
|
|
|
|
from dateutil import parser
|
|
|
|
from app.utils.csv import get_user_preferred_timezone_obj
|
|
|
|
|
|
def get_current_financial_year():
|
|
preferred_tz = get_user_preferred_timezone_obj()
|
|
now = datetime.now(preferred_tz)
|
|
current_year = int(now.strftime("%Y"))
|
|
return current_year
|
|
|
|
|
|
def is_less_than_days_ago(date_from_db, number_of_days):
|
|
return (
|
|
datetime.now(ZoneInfo("UTC")) - parser.parse(date_from_db)
|
|
).days < number_of_days
|
|
|
|
|
|
def parse_naive_dt(dt):
|
|
return parser.parse(dt, ignoretz=True)
|