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

Clarification on timezones - UTC versus local times and offsets #1095

Closed
scottyhq opened this issue Apr 20, 2021 · 4 comments · Fixed by #1099
Closed

Clarification on timezones - UTC versus local times and offsets #1095

scottyhq opened this issue Apr 20, 2021 · 4 comments · Fixed by #1099
Milestone

Comments

@scottyhq
Copy link

https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md#properties-object states that datetime requires UTC, but not very emphatically:

REQUIRED. The searchable date and time of the assets, in UTC. It is formatted according to RFC 3339, section 5.6. null is allowed, but requires start_datetime and end_datetime from common metadata to be set.

I'm used to seeing UTC times in metadata, but it's also convenient to have the timezone information somewhere to easily convert to local time without relying on location-based lookups. "time-numoffset" according to (https://tools.ietf.org/html/rfc3339#section-5.6)

This came up in a discussion of how to structure libraries that load in data from STAC records. Essentially, is it safe to assume times will always be UTC?
gjoseph92/stackstac#2 (comment)

@scottyhq
Copy link
Author

Also copying over the comment from @m-mohr in the issue linked above:

I'm not sure myself. I'd suggest opening an issue in stac-spec with a use case description so that we can discuss there. I could imagine that this is a legacy thing that we still want to change, although start_datetime and end_datetime also require UTC. On the other hand, created and updated don't require UTC.

I was mostly interested in properties:datetime but i could see an advantage in enforcing consistency and stating in bold that all times in STAC metadata should be in UTC. Which would also eliminate the possibility of storing valid ISO8601 strings like '2018-10-28T01:30:00+02:00'. And having code that ingests STAC do conversions such as (pandas.to_datetime('2018-10-28T01:30:00+02:00').tz_convert('UTC'))

@m-mohr m-mohr added this to the 1.0.0-rc.3 milestone Apr 21, 2021
@m-mohr
Copy link
Collaborator

m-mohr commented Apr 23, 2021

ToDos:

  • If we decide on all UTC, we should add the requirement to the timestamp extension + created + updated. We should also add something to the JSON Schema that checks it, e.g. a pattern like /Z$/ or so.
  • If we decide against UTC, we need to remove it from datetime + start/end_datetime.

@cholmes
Copy link
Contributor

cholmes commented Apr 23, 2021

I think enforcing UTC is more in line with the general STAC philosophy - have the 'main' thing be clear and easy. We use GeoJSON, and don't get into projections for the main geometry stuff.

But agree we should emphasize it more.

I think for easy conversion to local time I could see an extension that helps with that. Lets you add more datetimes in local time zones or something... But I prefer making the default path simple, and not allowing more options that force more complexity on every client.

m-mohr added a commit that referenced this issue Apr 23, 2021
@m-mohr m-mohr mentioned this issue Apr 23, 2021
4 tasks
@m-mohr m-mohr linked a pull request Apr 23, 2021 that will close this issue
4 tasks
@m-mohr
Copy link
Collaborator

m-mohr commented Apr 23, 2021

It's all UTC now.

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 a pull request may close this issue.

3 participants