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

fix: parsing time stamps with time zone offsets containing colons #291

Merged
merged 6 commits into from
Aug 30, 2024

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

@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.

R/parse.R Outdated Show resolved Hide resolved
tests/testthat/test-parse.R Outdated Show resolved Hide resolved
tests/testthat/test-parse.R Show resolved Hide resolved
R/parse.R Outdated Show resolved Hide resolved
tests/testthat/test-parse.R Outdated Show resolved Hide resolved
@toph-allen toph-allen merged commit ca4b646 into main Aug 30, 2024
19 checks passed
@toph-allen toph-allen deleted the toph/issue-290 branch August 30, 2024 21:26
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
4 participants