Orekit parses non-existent dates in UTC
The AbsoluteDate(String, TimeScale)
constructor is inconsistent in its handling of non-existent dates. If the seconds of minute number is >=61
an exception is thrown, but no exception is thrown if the seconds of minute number is <61
. For example, an exception will not be thrown for 2009-12-31T23:59:60.5Z
which is an invalid date (no leap second at that time), but an exception will be thrown for 2009-12-31T23:59:61.5Z
which is also an invalid date.
At a minimum the behavior should be documented. For the sake of consistency all invalid times should be treated the same way. Either invalid times throw exceptions, or they don't. If they don't document the algorithm for converting invalid times to valid times.
The also affects DateTimeComponents.parseDateTime(String)
and TimeComponents.parseTime(String)
.
Failing test case:
try {
// leap when not expected
new AbsoluteDate("2009-12-31T23:59:60.5Z", utc);
Assert.fail("Expected Exception");
} catch (OrekitException e) {
// expected
}