diff method
Returns the difference between this Jiffy instance and the given
jiffy
instance as a numeric value.
The unit
parameter specifies the unit in which to return the difference.
The default value is Unit.microsecond.
The optional asFloat
parameter determines whether to return the
difference as a floating-point number. The default value is false
.
Example:
final jiffy1 = Jiffy(DateTime(2022, 2, 1, 0, 0, 0));
final jiffy2 = Jiffy(DateTime(2022, 2, 15, 12, 30, 0));
// Calculate the difference between the two Jiffy instances in days
final diffInDays = jiffy1.diff(jiffy2, unit: Unit.DAY);
print('Difference in days: $diffInDays');
// output: Difference in days: -14
Implementation
num diff(Jiffy jiffy, {Unit unit = Unit.microsecond, bool asFloat = false}) {
return _display.diff(dateTime, jiffy.dateTime, unit, asFloat);
}