subtractMinutes method

DateTime subtractMinutes(
  1. int minutes
)

Subtracts the specified number of minutes from the current DateTime.

Args: minutes (int): The number of minutes to subtract.

Returns: DateTime: A new DateTime object with the subtracted minutes.

Implementation

DateTime subtractMinutes(int minutes) {
  if (minutes == 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).subtract(minutes: minutes).dateTime;
}