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

#972: Ensure a consistent timezone is used in comparisons #973

Merged
merged 1 commit into from
Oct 5, 2024

Conversation

mc1arke
Copy link
Owner

@mc1arke mc1arke commented Oct 5, 2024

The service code uses DateUtils to convert a long into a String format, which DateUtils converting the long to an instant, then an OffsetDateTime before passing this through a formatter, using the local timezone during the OffsetDateTime conversion.
As the test was using a pre-created String based on the UTC timezone, the test does not correctly compare the values when being executed in a different timezone. To overcome this, the test has been altered to use the same DateUtils methods to convert from the long to a String, thereby ensuring the same timezone handling is using in both test and live code.

The service code uses DateUtils to convert a long into a String format,
which DateUtils converting the long to an instant, then an
OffsetDateTime before passing this through a formatter, using the local
timezone during the OffsetDateTime conversion.
As the test was using a pre-created String based on the UTC timezone,
the test does not correctly compare the values when being executed in a
different timezone. To overcome this, the test has been altered to use
the same DateUtils methods to convert from the long to a String, thereby
ensuring the same timezone handling is using in both test and live code.
Copy link

sonarqubecloud bot commented Oct 5, 2024

@mc1arke mc1arke merged commit a228d9f into master Oct 5, 2024
12 checks passed
@mc1arke mc1arke deleted the issue/972 branch October 5, 2024 11:19
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.

1 participant