Skip to content

Update time toString() methods

Evan Ward requested to merge date-time-tostring-590-591-637-825 into develop

Previously the DateTimeComponents, TimeComponents, and AbsoluteDate toString() methods did not include the UTC offset. UTC offset is part of TimeComponents and the method signature of some toString() methods so it's ommission did not accurately represent the data. In ISO 8601 if the UTC offset is missing then times are interpreted as local, which is not intended. Added methods for printing without the UTC offset as well. The AbsoluteDate.toString(TimeScale) and AbsoluteDate.toString() methods still do not print the UTC offset because many time scales have non-integer minute offsets to UTC which is not supported in ISO 8601.

Previously DateTimeComponents.toString() could not print times during leap seconds. Now it can.

Previously the DateTimeComponents and TimeComponents toString() methods could round up to invalid times when within 0.5 ms of the next minute. Now they do not round up because they print additional digits when necessary.

These are backwards incompatible changes.

Added DateTimeComponents.toString(int, int) for user controlled rounding.

Fixes #637, #590 (closed), #591 (closed), #825 (closed)

Edited by Evan Ward

Merge request reports