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

Respect tzinfo in the provided datetime #70

Merged
merged 2 commits into from
Jan 29, 2020

Conversation

tschaub
Copy link
Contributor

@tschaub tschaub commented Jan 24, 2020

It looks like the fix for #56 got closer to being able to represent dates as RFC-3339 formatted strings. However, it looks like any tzinfo in the provided datetime is ignored. So the current utils.datetime_to_str() function works for timezone naive datetimes, but not for timezone aware datetimes.

This branch proposes to treat timezone naive datetimes as UTC datetimes (in line with the current assumptions) but respects any tzinfo in the provided datetime.

Copy link
Member

@lossyrob lossyrob left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @tschaub !

All the examples in the stac spec use the Z representation for UTC, as opposed to +00:00. I'd like to keep that for keeping in line with those examples - perhaps if the tzinfo is None or matches UTC, use the Z, else use the iso format?

@tschaub
Copy link
Contributor Author

tschaub commented Jan 29, 2020

Thanks for the nice library, @lossyrob.

I updated the branch to prefer the "Z" suffix for zero-offset timestamps.

Copy link
Member

@lossyrob lossyrob left a comment

Choose a reason for hiding this comment

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

Looks good!

@lossyrob lossyrob merged commit c33ae13 into stac-utils:develop Jan 29, 2020
@tschaub tschaub deleted the respect-tzinfo branch January 30, 2020 00:56
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.

2 participants