- 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
14 lines
343 B
Python
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
|