From 0b3845a15cbd9973d2564e9d0cac984cb4161b53 Mon Sep 17 00:00:00 2001 From: glopesdev Date: Mon, 21 Oct 2024 10:53:10 +0100 Subject: [PATCH] Use timezone aware objects for record timestamps --- pluma/export/ogcapi/records.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pluma/export/ogcapi/records.py b/pluma/export/ogcapi/records.py index 6b62124..ab8518f 100644 --- a/pluma/export/ogcapi/records.py +++ b/pluma/export/ogcapi/records.py @@ -3,7 +3,7 @@ import pandas as pd from pathlib import Path from geopandas import GeoDataFrame -from datetime import datetime +from datetime import datetime, timezone from pluma.schema import Dataset from dataclasses import dataclass, field, fields @@ -46,7 +46,7 @@ def __init__(self, dataset: Dataset, gdf: GeoDataFrame, properties: RecordProper self.id = f"{root_path.name.lower()}" self.start_date = gdf.index[0] self.end_date = gdf.index[-1] - self.created_timestamp = pd.Timestamp(datetime.utcnow()) + self.created_timestamp = pd.Timestamp(datetime.now(timezone.utc)) self.updated_timestamp = self.created_timestamp self.resolution = isodate.duration_isoformat(pd.Timedelta(gdf.index.freq)) self.bounds = gdf.total_bounds