Files
armonia-api/app/services/timestamps.py
T
kiskaadee 14ef3d1751 refactor(services): extract domain booking logic and configure mutmut
- Extract buffer collision arithmetic, 48-hour follow-up evaluation, and folio/link generation from bookings router into app/services/bookings.py
- Move parse_iso_datetime to app/services/timestamps.py for shared UTC normalization
- Refactor app/routers/bookings.py to consume extracted domain services
- Configure mutmut 3.8+ in pyproject.toml targeting app/services/ with also_copy = ["app"] and unit test selection
- Add mutants/ to .gitignore to prevent linting pollution

Refs: #6
2026-10-19 13:50:44 -05:00

14 lines
343 B
Python

from datetime import UTC, datetime
def utc_now_iso() -> str:
return datetime.now(UTC).isoformat()
def parse_iso_datetime(dt_str: str) -> datetime:
"""Parse an ISO 8601 string, normalizing naive datetimes to UTC."""
dt = datetime.fromisoformat(dt_str)
if dt.tzinfo is None:
dt = dt.replace(tzinfo=UTC)
return dt