Offset.hoursAndMinutes constructor

Offset.hoursAndMinutes(
  1. int hours,
  2. int minutes
)

Returns an offset for the specified number of hours and minutes.

The result simply takes the hours and minutes and converts each component into milliseconds separately. As a result, a negative offset should usually be obtained by making both arguments negative. For example, to obtain 'three hours and ten minutes behind UTC' you might call Offset.hoursAndMinutes(-3, -10).

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

Returns: An offset representing the given value.

RangeError: The result of the operation is outside the range of Offset.

Implementation

factory Offset.hoursAndMinutes(int hours, int minutes) =>
    Offset(hours * TimeConstants.secondsPerHour + minutes * TimeConstants.secondsPerMinute);