Currently, there is no utility for serializing asyncpg Range datetime objects to JSON-safe strings. Raw datetime objects coming back from the database would crash if returned in a response body, and any future handling would require scattering .isoformat() calls across the codebase.
For the upcoming STAC and DCAT-AP connector that is in the GSOC ideas list, dct:temporal, dct:issued, dct:modified, and STAC item temporal extents all need clean ISO 8601 strings derived from phenomenonTime and resultTime ranges.
def serialize_datetime_range(range_value):
if range_value is None:
return None
start = range_value.lower.isoformat() if range_value.lower else None
end = range_value.upper.isoformat() if range_value.upper else None
return {"start": start, "end": end}
I just wanted to ask about the '.isoformat()' everywhere, is that intentional, or is centralizing this the right direction?
Currently, there is no utility for serializing asyncpg Range datetime objects to JSON-safe strings. Raw datetime objects coming back from the database would crash if returned in a response body, and any future handling would require scattering .isoformat() calls across the codebase.
For the upcoming STAC and DCAT-AP connector that is in the GSOC ideas list,
dct:temporal,dct:issued,dct:modified, and STAC item temporal extents all need cleanISO 8601strings derived fromphenomenonTimeandresultTime ranges.I just wanted to ask about the '.isoformat()' everywhere, is that intentional, or is centralizing this the right direction?