Fix ingest timezone parsing#63876
Conversation
When timezone paramter is specified it should recalculate the timezone provided in a date format
|
@elasticmachine update branch |
|
Pinging @elastic/es-core-features (Team:Core/Features) |
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
rjernst
left a comment
There was a problem hiding this comment.
This looks fine, but it seems there is an unrelated change in here?
| if (accessor.isSupported(ChronoField.YEAR) == false | ||
| && accessor.isSupported(ChronoField.YEAR_OF_ERA) == false | ||
| && accessor.isSupported(WeekFields.of(locale).weekOfWeekBasedYear()) == false) { | ||
| && accessor.isSupported(WeekFields.of(locale).weekBasedYear()) == false) { |
There was a problem hiding this comment.
Is this change unrelated to the timezone issue?
There was a problem hiding this comment.
not related to the timezone issue, but also mentioned by a user #63458 (comment)
I realised I have not added a test case for it
There was a problem hiding this comment.
I think it would be better to isolate such a separate fix, so that the commit message is associated with what is being fixed, rather than a seemingly unrelated change.
There was a problem hiding this comment.
this is a good idea, better to isolate this change.
A separate PR #65717
|
@elasticmachine update branch |
|
@elasticmachine update branch |
this commit aligns timezone parsing logic with DateFormat.Iso8601. Timezone can be provided on a pattern and as ingest parameter. When no timezone is provided on a pattern it is defaulted to UTC or an ingest parameter (if provided). When timezone is not present in a pattern, but an ingest timezone parameter is provided - a date should be parsed as if it was in that timezone. Example: pattern "uuuu-MM-dd'T'HH:mm", text "2020-01-01T01:00", timezone: -01:00 should return 2020-01-01T01:00:00-01:00 If the pattern has a timezone and a timezone parameter is provided - a date should parsed with a timezone from input, and then "recalculated" to an ingest parameter Example "uuuu-MM-dd'T'HH:mm XXX", text "2020-01-01T01:00 -02:00", timezone -01:00 should return 2020-01-01T02:00:00-01:00 relates elastic#38407 relates elastic#51215 closes elastic#63458
this commit aligns timezone parsing logic with DateFormat.Iso8601. Timezone can be provided on a pattern and as ingest parameter. When no timezone is provided on a pattern it is defaulted to UTC or an ingest parameter (if provided). When timezone is not present in a pattern, but an ingest timezone parameter is provided - a date should be parsed as if it was in that timezone. Example: pattern "uuuu-MM-dd'T'HH:mm", text "2020-01-01T01:00", timezone: -01:00 should return 2020-01-01T01:00:00-01:00 If the pattern has a timezone and a timezone parameter is provided - a date should parsed with a timezone from input, and then "recalculated" to an ingest parameter Example "uuuu-MM-dd'T'HH:mm XXX", text "2020-01-01T01:00 -02:00", timezone -01:00 should return 2020-01-01T02:00:00-01:00 relates #38407 relates #51215 closes #63458 backports #63876
this commit aligns timezone parsing logic with
DateFormat.Iso8601. Timezone can be provided on a pattern and as ingest parameter. When no timezone is provided on a pattern it is defaulted to UTC or an ingest parameter (if provided).When timezone is not present in a pattern, but an ingest timezone parameter is provided - a date should be parsed as if it was in that timezone.
Example: pattern "uuuu-MM-dd'T'HH:mm", text "2020-01-01T01:00", timezone:
-01:00should return2020-01-01T01:00:00-01:00If the pattern has a timezone and a timezone parameter is provided - a date should parsed with a timezone from input, and then "recalculated" to an ingest parameter
Example "uuuu-MM-dd'T'HH:mm XXX", text "2020-01-01T01:00 -02:00", timezone
-01:00should return2020-01-01T02:00:00-01:00relates #38407
relates #51215
closes #63458