nasa / python_cmr

Python library for querying the common metadata repository.
MIT License
24 stars 22 forks source link

allow more flexible date handling #30

Closed itcarroll closed 7 months ago

itcarroll commented 7 months ago

Closes #29

The temporal filter accepts objects with a strftime method (e.g Python's standard library date and datetime objects) or "ISO-8601 strings", but it doesn't accept all ISO-8601 strings and it doesn't handle non utc datetime objects.

This PR offers an enhancement that accepts ISO-8601 strings with reduced precision. A user can supply a year (e.g. party like it's "1999") or a month (e.g. "1963-12" ... what a night) and get a valid interpretation. As part of this implementation, the temporal filter knows to round-down the "date-from" and round-up the "date-to".

This PR also offers the enhancement of accepting strings or datetime objects that specify a timezone, and converts them to UTC for the CMR API.

The first commit is just a bit of housekeeping (poetry indicated the poetry.lock file was out of sync with pyproject.toml).

frankinspace commented 7 months ago

Thank you @itcarroll . For the future, please add an entry to the 'Unreleased' section of the CHANGELOG when submitting pull requests. Great work!