Skip to content

Fix DateTimeComponents.toString()

Evan Ward requested to merge dtc-tostring-590 into develop

Delegate to toStringRfc3339(). Previously toString() had three issues:

  • could not print times during leap seconds
  • could round up to invalid times when within 0.5 ms of the next minute
  • generated invalid ISO 8601 because it left out the time zone

The last point also lost information because the time zone information was never printed leading to two dates with the same local time having the same string representation.

The implementation in toStringRfc3339() fixes these issues for all reasonable dates, but is not backwards compatible with the existing implementation. In particular it will include the time zone information and emit more digits to avoid rounding up.

Fix #590 (closed)

Merge request reports