Skip to content

[8.4] Extend the date rounding logic to be conditional (#89693)#89794

Merged
pgomulka merged 1 commit intoelastic:8.4from
pgomulka:bp_rounding_logic_conditional
Sep 5, 2022
Merged

[8.4] Extend the date rounding logic to be conditional (#89693)#89794
pgomulka merged 1 commit intoelastic:8.4from
pgomulka:bp_rounding_logic_conditional

Conversation

@pgomulka
Copy link
Copy Markdown
Contributor

@pgomulka pgomulka commented Sep 5, 2022

Date rounding logic should take into account the fields that will be
parsed be a parser. If a parser has a DayOfYear field, the rounding logic
should not try to default DayOfMonth as it will conflict with DayOfYear

However the DateTimeFormatter does not have a public method to return
information of fields that will be parsed. The hacky workaround is
to rely on toString() implementation that will return a field info when
it was defined with textual pattern.

This commits introduced conditional logic for DayOfMonth, MonthOfYear, ClockHourOfAMPM and HourOfAmPM

closes #89096
closes #58986
backports #89693

  • Have you signed the contributor license agreement?
  • Have you followed the contributor guidelines?
  • If submitting code, have you built your formula locally prior to submission with gradle check?
  • If submitting code, is your pull request against main? Unless there is a good reason otherwise, we prefer pull requests against main and will backport as needed.
  • If submitting code, have you checked that your submission is for an OS and architecture that we support?
  • If you are submitting this code for a class then read our policy for that.

Date rounding logic should take into account the fields that will be
parsed be a parser. If a parser has a DayOfYear field, the rounding logic
should not try to default DayOfMonth as it will conflict with DayOfYear

However the DateTimeFormatter does not have a public method to return
information of fields that will be parsed. The hacky workaround is
to rely on toString() implementation that will return a field info when
it was defined with textual pattern.

This commits introduced conditional logic for DayOfYear, ClockHourOfAMPM and HourOfAmPM

closes elastic#89096
closes elastic#58986
@pgomulka pgomulka added >bug :Core/Infra/Core Core issues without another label backport v8.4.2 labels Sep 5, 2022
@pgomulka pgomulka self-assigned this Sep 5, 2022
@pgomulka pgomulka merged commit 330c97e into elastic:8.4 Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport >bug :Core/Infra/Core Core issues without another label v8.4.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant