-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
base: 8.x
Are you sure you want to change the base?
Conversation
Documentation preview: |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
e1f8795
to
f16d4c1
Compare
@@ -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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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