subtractHours method

  1. @useResult
DateTime subtractHours(
  1. int hours
)

Subtracts the specified number of hours from the current DateTime.

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

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

Implementation

@useResult
DateTime subtractHours(int hours) {
  if (hours == 0) {
    return this;
  }

  return Jiffy.parseFromDateTime(this).subtract(hours: hours).dateTime;
}