ZonedTimeFormatter.specificShort constructor

ZonedTimeFormatter.specificShort(
  1. Locale locale, {
  2. DateTimeLength? length,
  3. TimePrecision? timePrecision,
  4. DateTimeAlignment? alignment,
})

Creates a zoned formatter based on a non-zoned formatter.

Caution: The locale provided here must match the locale used to construct the non-zoned formatter, or else unexpected behavior may occur!

See the Rust documentation for SpecificShort for more information.

Throws DateTimeFormatterLoadError on failure.

Implementation

factory ZonedTimeFormatter.specificShort(Locale locale, {DateTimeLength? length, TimePrecision? timePrecision, DateTimeAlignment? alignment}) {
  final result = _icu4x_ZonedTimeFormatter_create_specific_short_mv1(locale._ffi, length != null ? _ResultInt32Void.ok(length.index) : _ResultInt32Void.err(), timePrecision != null ? _ResultInt32Void.ok(timePrecision.index) : _ResultInt32Void.err(), alignment != null ? _ResultInt32Void.ok(alignment.index) : _ResultInt32Void.err());
  if (!result.isOk) {
    throw DateTimeFormatterLoadError.values.firstWhere((v) => v._ffi == result.union.err);
  }
  return ZonedTimeFormatter._fromFfi(result.union.ok, []);
}