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

Specify timezone for GregorianCalender in testDateFormatString() #1665

Closed
wants to merge 1 commit into from
Closed

Specify timezone for GregorianCalender in testDateFormatString() #1665

wants to merge 1 commit into from

Conversation

LorenzNickel
Copy link
Contributor

The date is formatted using format(Date) which uses UTC-timezone as no other timezone is specified
GregorianCalender instead uses the system-default timezone, which makes this test not pass in all timezones
Therefore the timezone of the calender should be specified before it's used to create a Date-instance using (by default) UTC-timezone

@LorenzNickel
Copy link
Contributor Author

LorenzNickel commented Mar 30, 2020

By the way I think the reason this "bug" was introduced is that the test passes if you are western to UTC (which means that your date is somewhere between 2018-08-25 00:00 and 2018-08-25 12:00, but since I'm living in Germany, it's 2018-08-24 22:00 (and in general 24th between 12:00 and 00:00)).

So TL;DR currently this test passes only if your computer has a timezone between UTC-12 and UTC

The date is formatted using format(Date) which uses UTC-timezone as no other timezone is specified
GregorianCalender instead uses the system-default timezone, which makes this test not pass in all timezones
Therefore the timezone of the calender should be specified before it's used to create a Date-instance using (by default) UTC-timezone
@asolntsev
Copy link

Why this PR is not still merged?
gson tests are failing on my machine right now. Should merged it!

@LorenzNickel
Copy link
Contributor Author

@asolntsev seems like gson is no longer actively maintained: #1821

@Marcono1234
Copy link
Collaborator

This was fixed by #1687; thanks nonetheless for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants