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

add detailed description of datetime parameter use #162

Merged
merged 4 commits into from
Aug 2, 2021

Conversation

philvarner
Copy link
Collaborator

Related Issue(s): #146

Proposed Changes:

  1. provide additional details about implementing the datetime parameter beyond what is provided in OAFeat.

PR Checklist:

  • This PR is made against the dev branch (all proposed changes except releases should be against dev, not master).
  • This PR has no breaking changes.
  • This PR does not make any changes to the core spec in the stac-spec directory (these are included as a subtree and should be updated directly in radiantearth/stac-spec)
  • I have added my changes to the CHANGELOG or a CHANGELOG entry is not required.

Thereby, the recommended process for parsing the datetime is:

1. uppercase the string (this avoids needing to match on both (t|T) and (z|Z))
2. split the string on `/` to determine if it is a single datetime or an interval
Copy link
Collaborator

Choose a reason for hiding this comment

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

The interval semantic was not mentioned before and it's not 100% clear whether the regexp accounts for this case (it does not, but should it?)

Copy link
Collaborator Author

@philvarner philvarner Jul 6, 2021

Choose a reason for hiding this comment

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

I've clarified the text. The regex is only for parsing a single datetime value.

1. uppercase the string (this avoids needing to match on both (t|T) and (z|Z))
2. split the string on `/` to determine if it is a single datetime or an interval
3. For each value of the split, check if it is either an open interval (the empty string or `..`), or if it matches the RFC3339 datetime regex
5. ISO8601 parse datetime strings using a library such as [pyiso8601](https://github.com/micktwomey/pyiso8601) or
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe list two libs for different languages instead of two libs for the same language?

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've added one that looks good for JavaScript. I mostly didn't want to recommend something that I wasn't sure if it worked or not. The main point was the Python's built-in library doesn't work, but I don't know about any other languages. I'm not even sure the Scala/JVM one worked correctly.


These are several examples of datetime intervals:

- `/`
Copy link
Collaborator

@m-mohr m-mohr Jul 6, 2021

Choose a reason for hiding this comment

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

What's the meaning of this? The same as ../..? Where is it specified that you don't need the ..?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

now that I read this again (http://docs.opengeospatial.org/is/17-069r3/17-069r3.html#_parameter_datetime), open start and open end is invalid -- I'll correct that.

As for the empty strings, the ABNF says:

interval-open-start = [".."] "/" date-time
interval-open-end = date-time "/" [".."]

and then later:

"Open ranges in time intervals at the start or end are supported using a double-dot (..) or an empty string for the start/end."

Copy link
Collaborator

@cholmes cholmes left a comment

Choose a reason for hiding this comment

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

Looks great. A nice addition.

@philvarner philvarner merged commit 58a9bf8 into radiantearth:dev Aug 2, 2021
@philvarner philvarner deleted the datetime-description branch August 2, 2021 14:13
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.

4 participants