Offset.hours constructor

Offset.hours(
  1. int hours
)

Returns an offset for the specified number of hours, which may be negative.

  • hours: The number of hours to represent in the new offset.

Returns: An offset representing the given value.

  • RangeError: The specified number of hours is outside the range of -18, +18.

Implementation

factory Offset.hours(int hours) {
  Preconditions.checkArgumentRange('hours', hours, _minHours, _maxHours);
  return Offset._(hours * TimeConstants.secondsPerHour);
}