add method

EtDatetime add(
  1. Duration duration
)
override

Returns a new EtDatetime instance with duration added to current instance.

var today = new EtDatetime.now();
var fiftyDaysFromNow = today.add(new Duration(days: 50));

Notice that the duration being added is actually 50 * 24 * 60 * 60 seconds. If the resulting EtDatetime has a different daylight saving offset than this, then the result won't have the same time-of-day as this, and may not even hit the calendar date 50 days later.

Be careful when working with dates in local time.

Implementation

EtDatetime add(Duration duration) {
  return EtDatetime.fromMillisecondsSinceEpoch(
      moment + duration.inMilliseconds);
}