Skip to content
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

feat: return datetime object for start_time and end_time #127

Merged
merged 4 commits into from
Nov 17, 2023

Conversation

rp280
Copy link
Collaborator

@rp280 rp280 commented Nov 16, 2023

closes #109

@rp280 rp280 requested a review from redfrexx November 16, 2023 12:33
Copy link
Collaborator

@SlowMo24 SlowMo24 left a comment

Choose a reason for hiding this comment

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

@redfrexx what is your opinion?

return self._metadata["extractRegion"]["temporalExtent"]["fromTimestamp"]
return dt.datetime.fromisoformat(
self._metadata["extractRegion"]["temporalExtent"]["fromTimestamp"].strip(
"Z"
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we stripping the tz here? if thats what the API gives us, we should happily return it. I think the API should not return a timezoned timestamp but if they do, tant pis

Copy link
Member

Choose a reason for hiding this comment

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

Since the 'Z' indicates that it is UTC timezone and the ohsome API can handle it with and without it, it is better to not remove it. I don't remember why I stripped it in the previous commented out version. So yes, please do not strip it but return the original ISO timestamp.

Copy link
Collaborator

Choose a reason for hiding this comment

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

note, that this is not about what the API supports. This is what we present to the user.

But I will adjust it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, so I read the documentation and it turns out that python 3.10 does not support it but python 3.11 and 3.12 do.

do we deprecate 3.10 or do we strip the Z?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for checking again, I wasn't aware of this. Since 3.10 is still used, I would strip the Z for now, and only remove it once we drop support for it. Maybe add a comment in the code explaining why we strip it.

return self._metadata["extractRegion"]["temporalExtent"]["toTimestamp"]
# return dt.datetime.fromisoformat(end_timestamp.strip("Z"))
return dt.datetime.fromisoformat(
self._metadata["extractRegion"]["temporalExtent"]["toTimestamp"].strip("Z")
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Member

Choose a reason for hiding this comment

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

same here as above

@SlowMo24 SlowMo24 requested a review from redfrexx November 17, 2023 08:25
@SlowMo24 SlowMo24 changed the title fileformatting feat: return datetime object for start_time and end_time Nov 17, 2023
return self._metadata["extractRegion"]["temporalExtent"]["fromTimestamp"]
return dt.datetime.fromisoformat(
self._metadata["extractRegion"]["temporalExtent"]["fromTimestamp"].strip(
"Z"
Copy link
Member

Choose a reason for hiding this comment

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

Since the 'Z' indicates that it is UTC timezone and the ohsome API can handle it with and without it, it is better to not remove it. I don't remember why I stripped it in the previous commented out version. So yes, please do not strip it but return the original ISO timestamp.

return self._metadata["extractRegion"]["temporalExtent"]["toTimestamp"]
# return dt.datetime.fromisoformat(end_timestamp.strip("Z"))
return dt.datetime.fromisoformat(
self._metadata["extractRegion"]["temporalExtent"]["toTimestamp"].strip("Z")
Copy link
Member

Choose a reason for hiding this comment

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

same here as above

@SlowMo24 SlowMo24 merged commit c70358c into master Nov 17, 2023
4 checks passed
@SlowMo24 SlowMo24 deleted the check_datetime2 branch November 17, 2023 11:34
@SlowMo24 SlowMo24 mentioned this pull request Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

return datetime for start_data and end_date
3 participants