joda-time
joda-time copied to clipboard
Constructing a period from partials fails when partial is a [dayOfYear = 366]
Not sure if this is supposed to fail. Probably not, as the year isn't known.
new Period(new Partial(DateTimeFieldType.dayOfYear(), 200), new Partial(DateTimeFieldType.dayOfYear(), 366));
// IllegalFieldValueException Value 366 for dayOfYear must be in the range [1,365]
// org.joda.time.field.FieldUtils.verifyValueBounds (FieldUtils.java:218)
// org.joda.time.field.PreciseDurationDateTimeField.set (PreciseDurationDateTimeField.java:79)
// org.joda.time.chrono.BaseChronology.set (BaseChronology.java:240)
// org.joda.time.base.BasePeriod.<init> (BasePeriod.java:182)
// org.joda.time.Period.<init> (Period.java:562)
Probably a bug, but may be hard to fix
This will be nigh on impossible to fix I think.
@jodastephen Should this issue be closed then?
@jodastephen If only 1970 was a leap year, this error would not have occurred.
And, if January 1970 had less than 31 days, even:
new Period(new Partial(DateTimeFieldType.dayOfMonth(),20),new Partial(DateTimeFieldType.dayOfMonth(),31));
would fail.