TomlTimeZoneOffset.fromDuration constructor

TomlTimeZoneOffset.fromDuration(
  1. Duration offset
)

Creates a time-zone offset from the given duration.

Throws an ArgumentError when the given duration does not correspond to a valid time zone offset.

Implementation

factory TomlTimeZoneOffset.fromDuration(Duration offset) =>
    TomlTimeZoneOffset._(
      isUtc: false,
      isNegative: offset.isNegative,
      hours: offset.inHours.abs(),
      minutes: offset.inMinutes.remainder(Duration.minutesPerHour).abs(),
    );