difference method
Returns a Duration with the difference when subtracting other
from
this.
The returned Duration will be negative if other
occurs after this.
var dayInPast = JDate.utc(1377, 3, 14);
var dayInNearFuture = JDate.utc(1405, 01, 01);
Duration difference = dayInPast.difference(dayInNearFuture);
assert(difference.inDays == -10152);
The difference is measured in seconds and fractions of seconds. The difference above counts the number of fractional seconds between midnight at the beginning of those dates. If the dates above had been in local time, not UTC, then the difference between two midnights may not be a multiple of 24 hours due to daylight saving differences.
Implementation
Duration difference(JDate other) =>
toDateTime().difference(other.toDateTime());