Skip to content

UTC datetime updates/fixes, several bugfixes.

Sölve Slettebak requested to merge solveslettebak/pychiver:master into master

Changelog:

  • timeutils.py: Updated getDateTimeObj() to require ISO-8601 string, or datetime object with UTC tzinfo from dateutil module. Attempt to convert otherwise. Returns UTC-aware datetime object with tzinfo from dateutil module. Raise ValueError otherwise.
  • timeutils.py: _getTimeStampFormatted() removed the "Z", because getDateTimeObj is now guaranteed to return UTC datetime obj with UTC offset (+HH:MM). Returns the string through quote() from urllib, to make it URL-compatible
  • timeutils.py: validateTimeStampsReturnObjects() if end_time is None, create UTC datetime object.
  • timeutils.py: Changed default time format to include microseconds (.%f), and UTC offset (%z). Affects getDateTimeString().
  • archiver.py: _get() added date format verification here (by calling getDateTimeObj in timeutils). Doesn't change end date if it was None to begin with.
  • endpoints.py: _fix() added dataset["time_dt"] which returns a datetime object in UTC. Did not replace the current, to not break scripts relying on this. Consider adding an option for this instead.
  • waveforms.py, archiver.py, endpoints.py: various functions. Added max_number_of_hours_back=24 all the way from initialization to json endpoint, so this function also works with waveforms.
  • note: timezone fixes to pychiver may have consequences for currently existing scripts, if they accomodated certain buggy behavior.

Merge request reports