SecondsTimedelta#

type safir.pydantic.SecondsTimedelta = Annotated[datetime.timedelta, pydantic.functional_validators.BeforeValidator(func=safir.pydantic._types.<lambda>, json_schema_input_type=PydanticUndefined), pydantic.functional_serializers.PlainSerializer(func=safir.pydantic._types.<lambda>, return_type=float, when_used=json)]#

Parse a float number of seconds into a datetime.timedelta.

Accepts as input an integer or float (or stringified integer or float) number of seconds or an already-parsed timedelta. Compared to the built-in Pydantic handling of timedelta, an integer number of seconds as a string is accepted, and ISO 8601 durations are not supported.