Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ 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)

### Removed

### Updated
Expand Down
5 changes: 4 additions & 1 deletion stac_fastapi/core/stac_fastapi/core/datetime_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ def normalize(dt):
dt_utc = MIN_DATE_NANOS
if dt_utc > MAX_DATE_NANOS:
dt_utc = MAX_DATE_NANOS
return dt_utc.isoformat(timespec="auto").replace("+00:00", "Z")
dt_normalized = dt_utc.isoformat(timespec="auto").replace("+00:00", "Z")
if "." not in dt_normalized:
dt_normalized = dt_normalized.replace("Z", ".0Z")
return dt_normalized

if not isinstance(date_str, str):
return f"{MIN_DATE_NANOS.isoformat(timespec='auto').replace('+00:00','Z')}/{MAX_DATE_NANOS.isoformat(timespec='auto').replace('+00:00','Z')}"
Expand Down