Skip to content

replace use of RFC339 constant with equivalent code #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2022
Merged
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
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""transactions extension client."""

import logging
from datetime import datetime
from datetime import datetime, timezone

import attr
import elasticsearch
from elasticsearch import helpers
from stac_pydantic.shared import DATETIME_RFC339

from stac_fastapi.elasticsearch.config import ElasticsearchSettings
from stac_fastapi.elasticsearch.serializers import CollectionSerializer, ItemSerializer
Expand Down Expand Up @@ -104,7 +103,7 @@ def create_collection(self, model: stac_types.Collection, **kwargs):
def update_item(self, model: stac_types.Item, **kwargs):
"""Update item."""
base_url = str(kwargs["request"].base_url)
now = datetime.utcnow().strftime(DATETIME_RFC339)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm removing all the uses of DATETIME_RFC339 is stac-fastapi right now, and we can remove all the uses of it in this repo after that's done.

now = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
model["properties"]["updated"] = str(now)

if not self.client.exists(index="stac_collections", id=model["collection"]):
Expand Down