Skip to content

Allow more digits in the year part of dates #72190

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

Closed
wants to merge 2 commits into from

Conversation

misterbyrne
Copy link

@misterbyrne misterbyrne commented Apr 24, 2021

Related to #72191

This mostly serves to illustrate the issue and the root cause :)

@elasticsearchmachine elasticsearchmachine added the external-contributor Pull request authored by a developer outside the Elasticsearch team label Apr 24, 2021

assertSameDate("2018-12-31T10:15:30", "date_optional_time");
assertSameDate("12018-12-31T10:15:30", "date_optional_time");
assertSameDate("122018-12-31T10:15:30", "date_optional_time");
Copy link
Author

Choose a reason for hiding this comment

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

The tests fail here without any code changes - output:

  2> java.lang.IllegalArgumentException: failed to parse date field [122018-12-31T10:15:30] with format [date_optional_time]
        at __randomizedtesting.SeedInfo.seed([3F1FADBA0ED58CED:34814355688917EA]:0)
        at org.elasticsearch.common.time.JavaDateFormatter.parse(JavaDateFormatter.java:170)
        at org.elasticsearch.common.joda.JavaJodaTimeDuellingTests.assertSameDate(JavaJodaTimeDuellingTests.java:887)
        at org.elasticsearch.common.joda.JavaJodaTimeDuellingTests.assertSameDate(JavaJodaTimeDuellingTests.java:875)
        at org.elasticsearch.common.joda.JavaJodaTimeDuellingTests.testDateOptionalTimeYearsWithManyDigits(JavaJodaTimeDuellingTests.java:228)

        Caused by:
        java.time.format.DateTimeParseException: Text '122018-12-31T10:15:30' could not be parsed, unparsed text found at index 5
            at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2055)
            at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1880)
            at org.elasticsearch.common.time.JavaDateFormatter.doParse(JavaDateFormatter.java:199)
            at org.elasticsearch.common.time.JavaDateFormatter.parse(JavaDateFormatter.java:168)
            ... 3 more

@imotov imotov added the :Search Foundations/Mapping Index mappings, including merging and defining field types label Apr 27, 2021
@cbuescher
Copy link
Member

@misterbyrne since this PR is mostly to demonstrate the problem and the original issue is assigned, I hope you don't mind me closing this.

@cbuescher cbuescher closed this May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-contributor Pull request authored by a developer outside the Elasticsearch team :Search Foundations/Mapping Index mappings, including merging and defining field types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants