add method

Jiffy add({
  1. int microseconds = 0,
  2. int milliseconds = 0,
  3. int seconds = 0,
  4. int minutes = 0,
  5. int hours = 0,
  6. int days = 0,
  7. int weeks = 0,
  8. int months = 0,
  9. int years = 0,
})

Adds date and time to the current Jiffy instance and returns a new Jiffy instance with the result.

The microseconds, milliseconds, seconds, minutes, hours, days, weeks, months, and years arguments allow you to specify additional time to add to the current Jiffy instance. These arguments are all optional and default to 0.

Example:

final jiffy = Jiffy.parse(
  '1997-09-23 13:37:00',
  pattern: 'yyyy-MM-dd HH:mm:ss'
);
final nextHour = jiffy.add(hours: 1);
print(nextHour.format('yyyy-MM-dd HH:mm:ss'));
// output: '1997-09-23 14:37:00'

Implementation

Jiffy add({
  int microseconds = 0,
  int milliseconds = 0,
  int seconds = 0,
  int minutes = 0,
  int hours = 0,
  int days = 0,
  int weeks = 0,
  int months = 0,
  int years = 0,
}) {
  final dateTime = _manipulator.add(this.dateTime, microseconds, milliseconds,
      seconds, minutes, hours, days, weeks, months, years);
  return _clone(dateTime);
}