Skip to content
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

Constructing a period from partials fails when partial is a [dayOfYear = 366] #90

Open
dm3 opened this issue Nov 26, 2013 · 4 comments
Open

Comments

@dm3
Copy link

dm3 commented Nov 26, 2013

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)
@jodastephen
Copy link
Member

Probably a bug, but may be hard to fix

@jodastephen
Copy link
Member

This will be nigh on impossible to fix I think.

@gauravsak
Copy link

gauravsak commented Aug 30, 2016

@jodastephen Should this issue be closed then?

@akarsh-jain
Copy link

akarsh-jain commented Dec 6, 2017

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants