from datetime import datetime from typing import Annotated from pydantic import PlainSerializer from core.timeutil import iso_z # Output type for moments (D-11): ISO-8601 UTC with "Z". Columns are UTCDateTime, so # values are always aware; a naive value here is a bug and raises. UTCDatetime = Annotated[ datetime, PlainSerializer(iso_z, return_type=str, when_used="json"), ]