difference method

Duration difference(
  1. EtDatetime date
)

Returns a Duration with the difference between this and other.

var berlinWallFell = new EtDatetime(1989, EtDatetime.november, 9);
var dDay = new EtDatetime(1944, EtDatetime.june, 6);

Duration difference = berlinWallFell.difference(dDay);
assert(difference.inDays == 16592);

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.

var berlinWallFell = new EtDatetime(1989, EtDatetime.november, 9);
var dDay = new EtDatetime(1944, EtDatetime.june, 6);
Duration difference = berlinWallFell.difference(dDay);
assert(difference.inDays == 16592);

will fail because the difference is actually 16591 days and 23 hours, and Duration.inDays only returns the number of whole days.

Implementation

Duration difference(EtDatetime date) =>
    Duration(days: (fixed - date.fixed).toInt());