2022-07-11 05:48:38 -05:00
|
|
|
from datetime import datetime
|
|
|
|
from datetime import timezone
|
|
|
|
|
|
|
|
from dateutil.parser import isoparse
|
|
|
|
|
|
|
|
|
|
|
|
def parse_isoformat(isodate: str) -> datetime:
|
|
|
|
return isoparse(isodate).astimezone(timezone.utc)
|
2022-07-14 09:29:17 -05:00
|
|
|
|
|
|
|
|
|
|
|
def now() -> datetime:
|
|
|
|
return datetime.now(timezone.utc)
|
2022-07-17 02:32:04 -05:00
|
|
|
|
|
|
|
|
|
|
|
def as_utc(dt: datetime) -> datetime:
|
|
|
|
return dt.replace(tzinfo=timezone.utc)
|