Skip to content

Commit 312d462

Browse files
Yuri ZmytrakovYuri Zmytrakov
authored andcommitted
fix: ensure isformat does not truncate 0Z
1 parent 375bb8d commit 312d462

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stac_fastapi/core/stac_fastapi/core/datetime_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ def normalize(dt):
3232
dt_utc = MIN_DATE_NANOS
3333
if dt_utc > MAX_DATE_NANOS:
3434
dt_utc = MAX_DATE_NANOS
35-
return dt_utc.isoformat(timespec="auto").replace("+00:00", "Z")
35+
dt_normalized = dt_utc.isoformat(timespec="auto").replace("+00:00", "Z")
36+
if "." in dt and "." not in dt_normalized:
37+
dt_normalized = dt_normalized.replace("Z", ".0Z")
38+
return dt_normalized
3639

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

0 commit comments

Comments
 (0)