mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 23:42:07 +01:00
Move UTC datetime normalization to a dedicated utils module for reusability across the codebase.
8 lines
192 B
Python
8 lines
192 B
Python
from datetime import datetime, timezone
|
|
|
|
|
|
def to_utc(dt: datetime) -> datetime:
|
|
if dt.tzinfo is None:
|
|
return dt.replace(tzinfo=timezone.utc)
|
|
return dt.astimezone(timezone.utc)
|