addHours method

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

Adds the specified number of hours to the current DateTime.

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

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

Implementation

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

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