timeTillNext method

Duration timeTillNext(
  1. TimePrecision precision
)

Returns the duration till the next precision

Implementation

Duration timeTillNext(TimePrecision precision) {
  DateTime truncated = rightTruncate(precision);

  var copier = truncated.copyWith;

  return Function.apply(copier, [], {
    Symbol(precision.toShortString()): value(precision) + 1
  }).difference(this);
}