From dddd7104865db56c59ea21d75ba939891249d4ea Mon Sep 17 00:00:00 2001 From: Stijn Caerts Date: Mon, 22 Apr 2024 17:14:58 +0200 Subject: [PATCH] apply datetime converter in ItemCollection endpoint model (#667) * apply datetime converter in ItemCollection endpoint model * update changelog --- CHANGES.md | 4 ++++ stac_fastapi/api/stac_fastapi/api/models.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 51b968156..1a5fc8494 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +* Apply datetime converter in ItemCollection endpoint model ([#667](https://github.com/stac-utils/stac-fastapi/pull/667)) + ## [2.5.2] - 2024-04-19 ### Fixed diff --git a/stac_fastapi/api/stac_fastapi/api/models.py b/stac_fastapi/api/stac_fastapi/api/models.py index 53f376aa0..c1d70b3cf 100644 --- a/stac_fastapi/api/stac_fastapi/api/models.py +++ b/stac_fastapi/api/stac_fastapi/api/models.py @@ -16,6 +16,7 @@ BaseSearchGetRequest, BaseSearchPostRequest, str2bbox, + str_to_interval, ) @@ -127,7 +128,7 @@ class ItemCollectionUri(CollectionUri): limit: int = attr.ib(default=10) bbox: Optional[BBox] = attr.ib(default=None, converter=str2bbox) - datetime: Optional[DateTimeType] = attr.ib(default=None) + datetime: Optional[DateTimeType] = attr.ib(default=None, converter=str_to_interval) class POSTTokenPagination(BaseModel):