Skip to content

Commit 93f9847

Browse files
committed
Leverage the project projection which handles units.
1 parent 9d5f8a7 commit 93f9847

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

opensensor/collection_apis.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,12 @@ def sample_and_paginate_collection(
486486

487487
# Add UTC offset to timestamp field
488488
for item in raw_data:
489-
item["timestamp"] = item["timestamp"].replace(tzinfo=timezone.utc).isoformat()
489+
if isinstance(item["timestamp"], datetime):
490+
item["timestamp"] = item["timestamp"].replace(tzinfo=timezone.utc).isoformat()
491+
elif isinstance(item["timestamp"], str):
492+
item["timestamp"] = (
493+
datetime.fromisoformat(item["timestamp"]).replace(tzinfo=timezone.utc).isoformat()
494+
)
490495

491496
if response_model is VPD:
492497
# If the response model is VPD, you already have VPD-related data from the pipeline.

0 commit comments

Comments
 (0)