| 1 | import { FFIError } from "./diplomat-runtime" |
| 2 | import { ICU4XDataProvider } from "./ICU4XDataProvider"; |
| 3 | import { ICU4XDate } from "./ICU4XDate"; |
| 4 | import { ICU4XDateLength } from "./ICU4XDateLength"; |
| 5 | import { ICU4XDateTime } from "./ICU4XDateTime"; |
| 6 | import { ICU4XError } from "./ICU4XError"; |
| 7 | import { ICU4XIsoDate } from "./ICU4XIsoDate"; |
| 8 | import { ICU4XIsoDateTime } from "./ICU4XIsoDateTime"; |
| 9 | import { ICU4XLocale } from "./ICU4XLocale"; |
| 10 | |
| 11 | /** |
| 12 | |
| 13 | * An ICU4X DateFormatter object capable of formatting a {@link ICU4XDate `ICU4XDate`} as a string, using some calendar specified at runtime in the locale. |
| 14 | |
| 15 | * See the {@link https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html Rust documentation for `DateFormatter`} for more information. |
| 16 | */ |
| 17 | export class ICU4XDateFormatter { |
| 18 | |
| 19 | /** |
| 20 | |
| 21 | * Creates a new {@link ICU4XDateFormatter `ICU4XDateFormatter`} from locale data. |
| 22 | |
| 23 | * See the {@link https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.try_new_with_length Rust documentation for `try_new_with_length`} for more information. |
| 24 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 25 | */ |
| 26 | static create_with_length(provider: ICU4XDataProvider, locale: ICU4XLocale, date_length: ICU4XDateLength): ICU4XDateFormatter | never; |
| 27 | |
| 28 | /** |
| 29 | |
| 30 | * Formats a {@link ICU4XDate `ICU4XDate`} to a string. |
| 31 | |
| 32 | * See the {@link https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format Rust documentation for `format`} for more information. |
| 33 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 34 | */ |
| 35 | format_date(value: ICU4XDate): string | never; |
| 36 | |
| 37 | /** |
| 38 | |
| 39 | * Formats a {@link ICU4XIsoDate `ICU4XIsoDate`} to a string. |
| 40 | |
| 41 | * Will convert to this formatter's calendar first |
| 42 | |
| 43 | * See the {@link https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format Rust documentation for `format`} for more information. |
| 44 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 45 | */ |
| 46 | format_iso_date(value: ICU4XIsoDate): string | never; |
| 47 | |
| 48 | /** |
| 49 | |
| 50 | * Formats a {@link ICU4XDateTime `ICU4XDateTime`} to a string. |
| 51 | |
| 52 | * See the {@link https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format Rust documentation for `format`} for more information. |
| 53 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 54 | */ |
| 55 | format_datetime(value: ICU4XDateTime): string | never; |
| 56 | |
| 57 | /** |
| 58 | |
| 59 | * Formats a {@link ICU4XIsoDateTime `ICU4XIsoDateTime`} to a string. |
| 60 | |
| 61 | * Will convert to this formatter's calendar first |
| 62 | |
| 63 | * See the {@link https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format Rust documentation for `format`} for more information. |
| 64 | * @throws {@link FFIError}<{@link ICU4XError}> |
| 65 | */ |
| 66 | format_iso_datetime(value: ICU4XIsoDateTime): string | never; |
| 67 | } |