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 chrono::DateTime<Utc> tests #1170

Merged
merged 1 commit into from
Aug 16, 2024
Merged

Conversation

allan2
Copy link
Contributor

@allan2 allan2 commented Aug 15, 2024

test_date_time_params and test_with_special_date_time_params could fail when run with a non-UTC system time zone.
I encountered these failing tests when writing the tests for jiff.

In Postgres, if no time zone is stated in the input string, then it is assumed to be in system time.[1] This means that in these tests, a correctly parsed DateTime<Utc> could be compared to an incorrectly offset time.

The offset component is now included in the test strings of these tests. This component is already present in the test strings for time::OffsetDateTime.

[1] Postgres docs:

For timestamp with time zone, the internally stored value is always in UTC (Universal Coordinated Time, traditionally known as Greenwich Mean Time, GMT). An input value that has an explicit time zone specified is converted to UTC using the appropriate offset for that time zone. If no time zone is stated in the input string, then it is assumed to be in the time zone indicated by the system's TimeZone parameter, and is converted to UTC using the offset for the timezone zone.

`test_date_time_params` and `test_with_special_date_time_params` could fail when run with a non-UTC system time zone.

In Postgres, if no time zone is stated in the input string, then it is assumed to be in system time.
This means that in these tests, a correctly parsed `DateTime<Utc>` could be compared to an incorrectly offset time.

The offset component is now included in the test strings of these tests. This component is already present in the test strings for `time::OffsetDateTime`.
@sfackler sfackler merged commit 2e6b7df into sfackler:master Aug 16, 2024
4 checks passed
@sfackler
Copy link
Owner

Thanks!

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.

2 participants