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

Explicitly use ISO weekfields for weekyear date formats #113787

Open
wants to merge 2 commits into
base: 8.x
Choose a base branch
from

Conversation

thecoop
Copy link
Member

@thecoop thecoop commented Sep 30, 2024

Contrary to what you might think, this is actually maintaining existing behaviour when run on JDK 22 and 23. IsoCalendarDataProvider overrides the root locale weekyear to use ISO, which effectively means we are already using ISO for all week-based date formats. Changing to JDK 23 means the locale-based ones use Sunday/1-day for weekfield definitions, so setting this to explicitly ISO is maintaining the existing behaviour. It also makes all week-date formats definitely use ISO definitions.

This is aimed at 8.x, as that's where all the docs are targetting. When we're all settled on the various PRs, I'll forward-port this to main, along with any relevant locale docs already merged into 8.x

@thecoop thecoop added :Core/Infra/Core Core issues without another label >refactoring v8.16.0 labels Sep 30, 2024
Copy link
Contributor

Documentation preview:

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Sep 30, 2024
@@ -97,6 +97,7 @@ Function<String, ZonedDateTime> getFunction(String format, ZoneId zoneId, Locale
// fill the rest of the date up with the parsed date
if (accessor.isSupported(ChronoField.YEAR) == false
&& accessor.isSupported(ChronoField.YEAR_OF_ERA) == false
&& accessor.isSupported(WeekFields.ISO.weekBasedYear()) == false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These additions, and similar, are because ISO.weekBasedYear is a different thing to of(locale).weekBasedYear, even though they probably represent the same thing

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >refactoring Team:Core/Infra Meta label for core/infra team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants