UtcOffset.fromSeconds constructor

UtcOffset.fromSeconds(
  1. int seconds
)

Creates an offset from seconds.

Errors if the offset seconds are out of range.

See the Rust documentation for try_from_seconds for more information.

Throws TimeZoneInvalidOffsetError on failure.

Implementation

factory UtcOffset.fromSeconds(int seconds) {
  final result = _icu4x_UtcOffset_from_seconds_mv1(seconds);
  if (!result.isOk) {
    throw TimeZoneInvalidOffsetError();
  }
  return UtcOffset._fromFfi(result.union.ok, []);
}