ZonedDateTime.lenientFromString constructor

ZonedDateTime.lenientFromString(
  1. String v,
  2. Calendar calendar,
  3. IanaParser ianaParser
)

Creates a new ZonedDateTime from an IXDTF string, without requiring the offset or calculating the zone variant.

See the Rust documentation for try_lenient_from_str for more information.

Throws Rfc9557ParseError on failure.

Implementation

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