addDays method

DateTime addDays(
  1. int days
)

Adds the specified number of days to the current DateTime.

Args: days (int): The number of days to add.

Returns: DateTime: A new DateTime object with the added days.

Implementation

DateTime addDays(int days) {
  if (days == 0) {
    // same
    return this;
  }

  // We used the Jiffy package to add years, months, etc
  // https://stackoverflow.com/questions/54792056/add-subtract-months-years-to-date-in-dart
  return Jiffy.parseFromDateTime(this).add(days: days).dateTime;
}