Skip to content

LocalDateTime doesn't support MAX YEAR in certain workflows #433

@gowrav27

Description

@gowrav27

LocalDateTime doesn't support MAX YEAR

Joda version:
2.9.9

Ex:

LocalDateTime localDateTimeMax  = new LocalDateTime (Long.MAX_VALUE);
new LocalDateTime (localDateTimeMax);
LocalDateTime localDateTime = new LocalDateTime (Long.MAX_VALUE);
System.out.println(localDateTime);

Posted the same on StackOverFlow

Problem description

The toString and certain constructors dont support Long.MAX_VALUE in LocalDateTime
I see this is similar to the issue resolved for DateTime

Example Stack Trace:

Exception in thread "main" org.joda.time.IllegalFieldValueException: Value 292278994 for year must be in the range [-292275054,292278993]
    at org.joda.time.field.FieldUtils.verifyValueBounds(FieldUtils.java:234)
    at org.joda.time.chrono.BasicYearDateTimeField.set(BasicYearDateTimeField.java:83)
    at org.joda.time.chrono.BaseChronology.set(BaseChronology.java:240)
    at org.joda.time.format.DateTimeFormatterBuilder$Fraction.printTo(DateTimeFormatterBuilder.java:1806)
    at org.joda.time.format.DateTimeFormatterBuilder$Composite.printTo(DateTimeFormatterBuilder.java:2474)
    at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:655)
    at org.joda.time.format.DateTimeFormatter.print(DateTimeFormatter.java:709)
    at org.joda.time.LocalDateTime.toString(LocalDateTime.java:2087)
    at java.lang.String.valueOf(String.java:2849)
    at java.lang.StringBuilder.append(StringBuilder.java:128)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions