mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-10 23:23:27 -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
17 lines
494 B
Python
17 lines
494 B
Python
import os
|
|
from zoneinfo import ZoneInfo
|
|
|
|
from dateutil import parser
|
|
|
|
local_timezone = ZoneInfo(os.getenv("TIMEZONE", "America/New_York"))
|
|
|
|
|
|
def utc_string_to_aware_gmt_datetime(date):
|
|
"""
|
|
Date can either be a string, naïve UTC datetime or an aware UTC datetime
|
|
Returns an aware local datetime, essentially the time you'd see on your clock
|
|
"""
|
|
date = parser.parse(date)
|
|
forced_utc = date.replace(tzinfo=ZoneInfo("UTC"))
|
|
return forced_utc.astimezone(local_timezone)
|