You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not really sure if this is a bug or if this is the expected behavior. I try to parse the ISO 8601 time interval "2007-03-01T13:00:00Z/P1Y2M10DT2H30M" as noted in the Wikepedia page. This is not possible with the current Interval implementation, because it doesn't support the date part of the interval. If I remove the date part, then it works as expected.
Interval.parse("2007-03-01T13:00:00Z/P1Y2M10DT2H30M") // FailsInterval.parse("2007-03-01T13:00:00Z/PT2H30M") // Works
It seems that the issue comes from the fact that the java.time.Duration class cannot parse this format. It seems that the current Java implementations uses two classes to represent the ISO 8601 duration format. The java.time.Period class can parse the date part and the java.time.Duration class can parse the time part.
I'm not really sure if this is wrong documented on the Wikipedia page, or if this is an issue in the library. Anyway, the org.joda.time.Interval does parse the string with the date part "2007-03-01T13:00:00Z/P1Y2M10DT2H30M".
The text was updated successfully, but these errors were encountered:
Not a bug, just an API-limitation (expected behaviour as documented).
public static Interval parse(CharSequence text)
Obtains an instance of Interval from a text string such as 2007-12-03T10:15:30Z/2007-12-04T10:15:30Z.
The string must consist of one of the following three formats:
•a representations of an Instant, followed by a forward slash, followed by a representation of a Instant
•a representation of an Instant, followed by a forward slash, followed by a representation of a Duration
•a representation of a Duration, followed by a forward slash, followed by a representation of an Instant
Personally I think that such a question is probably better located at Stackoverflow to get more detailed answers and to reach a broader audience. I am also not sure how far this project will go to implement all the many ISO-8601-features (not always easy to implement!), see examples in my interval implementation or this old Joda-issue.
I'm not really sure if this is a bug or if this is the expected behavior. I try to parse the ISO 8601 time interval "2007-03-01T13:00:00Z/P1Y2M10DT2H30M" as noted in the Wikepedia page. This is not possible with the current
Interval
implementation, because it doesn't support the date part of the interval. If I remove the date part, then it works as expected.It seems that the issue comes from the fact that the
java.time.Duration
class cannot parse this format. It seems that the current Java implementations uses two classes to represent the ISO 8601 duration format. Thejava.time.Period
class can parse the date part and thejava.time.Duration
class can parse the time part.I'm not really sure if this is wrong documented on the Wikipedia page, or if this is an issue in the library. Anyway, the
org.joda.time.Interval
does parse the string with the date part "2007-03-01T13:00:00Z/P1Y2M10DT2H30M".The text was updated successfully, but these errors were encountered: