Skip to content

Commit 83b1d67

Browse files
authored
Merge branch 'main' into CAT-1310-2
2 parents 6dfc9a1 + 77d77d4 commit 83b1d67

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2323
- Added `id` field as secondary sort to sort config to ensure unique pagination tokens. [#421](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/421)
2424
- Added default environment variable `STAC_ITEM_LIMIT` to SFEOS for result limiting of returned items and STAC collections [#419](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/419)
2525
- Added the `ENV_MAX_LIMIT` environment variable to SFEOS, allowing overriding of the `MAX_LIMIT`, which controls the `?limit` parameter for returned items and STAC collections. [#434](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/434)
26+
- Updated the `format_datetime_range` function to support milliseconds. [#423](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/423)
2627

2728
### Changed
2829

stac_fastapi/core/stac_fastapi/core/datetime_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@ def format_datetime_range(date_str: str) -> str:
1717
"""
1818

1919
def normalize(dt):
20+
"""Normalize datetime string and preserve millisecond precision."""
2021
dt = dt.strip()
2122
if not dt or dt == "..":
2223
return ".."
2324
dt_obj = rfc3339_str_to_datetime(dt)
2425
dt_utc = dt_obj.astimezone(timezone.utc)
25-
return dt_utc.strftime("%Y-%m-%dT%H:%M:%SZ")
26+
return dt_utc.isoformat(timespec="milliseconds").replace("+00:00", "Z")
2627

2728
if not isinstance(date_str, str):
2829
return "../.."
30+
2931
if "/" not in date_str:
3032
return f"{normalize(date_str)}/{normalize(date_str)}"
33+
3134
try:
3235
start, end = date_str.split("/", 1)
3336
except Exception:

0 commit comments

Comments
 (0)