IvoaIsoDatetime#

type safir.pydantic.IvoaIsoDatetime = Annotated[datetime.datetime, pydantic.functional_validators.BeforeValidator(func=safir.pydantic._validators.normalize_isodatetime, json_schema_input_type=PydanticUndefined), pydantic.functional_serializers.PlainSerializer(func=safir.datetime._format.isodatetime, return_type=str, when_used=json)]#

Accept the ISO datetime format required by IVOA standards.

The IVOA DALI standard requires timestamps to be formatted as in ISO 8601 but without full timezone information. Either the timezone should be omitted or the time portion should end in Z, and in either case the timestamp should be interpreted as UTC.

This type accepts the input formats that DALI accepts, provides a timezone-aware datetime in UTC, and always serializes to the ISO 8601 format ending in Z.