ZonedDateTimeFormatter.withLength constructor

ZonedDateTimeFormatter.withLength(
  1. DataProvider provider,
  2. Locale locale,
  3. DateTimeLength length
)

Creates a new `ZonedDateTimeFormatter` from locale data.

This function has date_length and time_length arguments and uses default options for the time zone.

Throws DateTimeFormatterLoadError on failure.

Implementation

factory ZonedDateTimeFormatter.withLength(DataProvider provider, Locale locale, DateTimeLength length) {
  final result = _icu4x_ZonedDateTimeFormatter_create_with_length_mv1(provider._ffi, locale._ffi, length.index);
  if (!result.isOk) {
    throw DateTimeFormatterLoadError.values.firstWhere((v) => v._ffi == result.union.err);
  }
  return ZonedDateTimeFormatter._fromFfi(result.union.ok, []);
}