Skip to content

Conversation

@toph-allen
Copy link
Collaborator

@toph-allen toph-allen commented Aug 27, 2024

Fixes #290

Intent

Fix a bug involving the handling of timestamps from Connect.

Approach

Connect sends timestamps in RFC 3339 format. Specifically:

  • Timestamps with no UTC offset end in Z, e.g. "2020-01-01T01:02:03Z"
  • Timestamps with an offset end in ±hh:mm, e.g. "2023-08-22T15:13:14+01:00"

Details on the approaches used.

  • This PR fixes a bug where we would not parse time stamps with an offset, resulting in NA values. It uses a combination of regular expressions and using different time format specifiers for different incoming time stamps.
  • Converts all incoming timestamps to UTC. Previously, we only parsed UTC times at all, but just fixing the time format revealed a bug where we assigned UTC to non-UTC timestamps.
  • Fixes a bug in make_timestamp(), which creates timestamps for Connect. Previously, would output all timestamps as UTC, even though they were in the local system time.

Tests

Added tests for a range of expected inputs. Tests take place in multiple time zones.

- implement new function for parsing RFC 3339 dates as sent by Connect
- add time zone guardrails to function to create timestamps for Connect
Copy link
Collaborator

@tdstein tdstein left a comment

Choose a reason for hiding this comment

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

Nicely done! Thanks for all of the comments. Do we need to verify that dates roll over correctly from different time zones into UTC?

Copy link
Contributor

@aronatkins aronatkins left a comment

Choose a reason for hiding this comment

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

Lacks NEWS update. Approval assumes addition of NEWS.

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.

get_audit_logs breaks time

5 participants