ZonedDateTime.offsetOnlyFromString constructor

ZonedDateTime.offsetOnlyFromString(
  1. String v,
  2. Calendar calendar
)

Creates a new ZonedDateTime from an offset-only IXDTF string.

See the Rust documentation for try_offset_only_from_str for more information.

Throws Rfc9557ParseError on failure.

Implementation

factory ZonedDateTime.offsetOnlyFromString(String v, Calendar calendar) {
  final temp = _FinalizedArena();
  final result = _icu4x_ZonedDateTime_offset_only_from_string_mv1(v._utf8AllocIn(temp.arena), calendar._ffi);
  if (!result.isOk) {
    throw Rfc9557ParseError.values[result.union.err];
  }
  return ZonedDateTime._fromFfi(result.union.ok);
}