Skip to content

Fix DateTimeFormatsTest locale-dependent failures#98

Merged
fluentfuture merged 4 commits intogoogle:masterfrom
nickita-khylkouski:issue-93-locale-tests
Jan 22, 2026
Merged

Fix DateTimeFormatsTest locale-dependent failures#98
fluentfuture merged 4 commits intogoogle:masterfrom
nickita-khylkouski:issue-93-locale-tests

Conversation

@nickita-khylkouski
Copy link
Copy Markdown
Contributor

Tests were failing in non-US locales (GB, FR, etc.) due to AM/PM parsing differences and timezone abbreviation ambiguity.

Added JUnit @rule to ensure all tests run with US locale and UTC timezone. The rule saves the original locale/timezone before each test and restores them in a finally block.

This approach follows the standard JUnit TestRule pattern and ensures test isolation without affecting production code.

Fixes #93

Tests were failing in non-US locales (GB, FR, etc.) due to:
- AM/PM parsing differences (US: "AM" vs UK: "am")
- Timezone abbreviation ambiguity (PST resolves differently)
- Date formatting variations across locales

Added JUnit @rule to ensure all tests run with US locale and UTC
timezone. The rule saves the original locale/timezone before each
test and restores them afterward in a finally block.

This approach follows the standard JUnit TestRule pattern and ensures
test isolation without affecting production code.

Fixes google#93
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Jan 22, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

English text patterns (month names, weekday names, AM/PM) now explicitly
use Locale.ENGLISH when creating DateTimeFormatter instances. This ensures
consistent parsing behavior regardless of the JVM's default locale.

Fixes google#99
@fluentfuture fluentfuture merged commit 89952b5 into google:master Jan 22, 2026
1 of 5 checks passed
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.

DateTimeFormatsTest fails when built in GB

2 participants