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
importstaticorg.junit.Assert.assertTrue;
importorg.joda.time.DateTime;
importorg.joda.time.DateTimeZone;
importorg.joda.time.Interval;
importorg.junit.Test;
publicclassTestInterval {
/* I don't have access to ISO 8601, but various sources on the * Internet (Wikipedia [1] and others) claim that when defining * intervals from two instants, unspecified fields in the second * instant of the interval should be copied from the first, * including timezones. * * As far as I can tell, unspecified timezones will always be * replaced with the local timezone. * * The strange timezone used in test was selected to minimize the * risk that it is the same as the local timezone. * * [1]: http://en.wikipedia.org/wiki/ISO_8601#Time_intervals */@TestpublicvoidtestInterval() {
StringintervalString = "2007-03-10T00:00+12:34/2007-03-11";
Intervalactual = Interval.parse(intervalString);
DateTimeZoneoffset = DateTimeZone.forOffsetHoursMinutes(12, 34);
DateTimestart = newDateTime(2007, 03, 10, 00, 00, offset);
DateTimeend = newDateTime(2007, 03, 11, 00, 00, offset);
Intervalexpected = newInterval(start, end);
assertTrue(expected.isEqual(actual));
}
}
The text was updated successfully, but these errors were encountered:
I have it on good authority that at least one version of ISO 8601 says this about the interval notation:
representations for time-zones and Coordinated Universal Time included with the component preceding the solidus shall be assumed to apply to the component following the solidus, unless a corresponding alternative is included
See comment in test for details.
The text was updated successfully, but these errors were encountered: