diff --git a/CHANGELOG.md b/CHANGELOG.md index d08fdce9..6862fd8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Fixed datetime filtering for .0Z milliseconds to preserve precision in apply_filter_datetime, ensuring only items exactly within the specified range are returned. [#535](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/535) +- Normalize datetime in POST /search requests to match GET /search behavior. [#543](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/543) ### Removed diff --git a/stac_fastapi/core/stac_fastapi/core/core.py b/stac_fastapi/core/stac_fastapi/core/core.py index 56d2333f..3334a4db 100644 --- a/stac_fastapi/core/stac_fastapi/core/core.py +++ b/stac_fastapi/core/stac_fastapi/core/core.py @@ -790,9 +790,10 @@ async def post_search( search=search, collection_ids=search_request.collections ) + datetime_parsed = format_datetime_range(date_str=search_request.datetime) try: search, datetime_search = self.database.apply_datetime_filter( - search=search, datetime=search_request.datetime + search=search, datetime=datetime_parsed ) except (ValueError, TypeError) as e: # Handle invalid interval formats if return_date fails