Advanced date, time and interval library for Java with sun/moon-astronomy and calendars like Chinese, Coptic, Ethiopian, French Republican, Hebrew, Hijri, Historic Christian, Indian National, Japanese, Julian, Korean, Minguo, Persian, Thai, Vietnamese
GNU Lesser General Public License v2.1
424
stars
62
forks
source link
Bug(?) parsing intervals with incomplete parts #979
When parsing intervals where the second part is incomplete, the time is interpreted incorrectly.
This example works:
MomentInterval.parseISO("2023-03-28T00:00:00-01:00/06:00")
This example does not work:
MomentInterval.parseISO("2023-03-28T00:00:00+01:00/06:00")
-> throws java.text.ParseException: Start after end: [2023-03-27T23:00:00Z]/(2023-03-27T05:00:00Z)
According to the ISO spec, the incomplete time should be completed using the same values from the left part.
I think the parseISO method tries to do this, but uses the date of the parsed value in Z timezone (i.c. 27) instead of the actual desired date (28).
When parsing intervals where the second part is incomplete, the time is interpreted incorrectly.
This example works: MomentInterval.parseISO("2023-03-28T00:00:00-01:00/06:00")
This example does not work: MomentInterval.parseISO("2023-03-28T00:00:00+01:00/06:00") -> throws java.text.ParseException: Start after end: [2023-03-27T23:00:00Z]/(2023-03-27T05:00:00Z)
According to the ISO spec, the incomplete time should be completed using the same values from the left part. I think the parseISO method tries to do this, but uses the date of the parsed value in Z timezone (i.c. 27) instead of the actual desired date (28).