| 1 |
import { u8, u16, i32, u32 } from "./diplomat-runtime" |
| 2 |
import { FFIError } from "./diplomat-runtime" |
| 3 |
import { ICU4XCalendar } from "./ICU4XCalendar"; |
| 4 |
import { ICU4XDate } from "./ICU4XDate"; |
| 5 |
import { ICU4XError } from "./ICU4XError"; |
| 6 |
import { ICU4XIsoWeekday } from "./ICU4XIsoWeekday"; |
| 7 |
import { ICU4XWeekCalculator } from "./ICU4XWeekCalculator"; |
| 8 |
import { ICU4XWeekOf } from "./ICU4XWeekOf"; |
| 9 |
|
| 10 |
/** |
| 11 |
|
| 12 |
* An ICU4X Date object capable of containing a ISO-8601 date |
| 13 |
|
| 14 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html Rust documentation for `Date`} for more information. |
| 15 |
*/ |
| 16 |
export class ICU4XIsoDate { |
| 17 |
|
| 18 |
/** |
| 19 |
|
| 20 |
* Creates a new {@link ICU4XIsoDate `ICU4XIsoDate`} from the specified date and time. |
| 21 |
|
| 22 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_new_iso_date Rust documentation for `try_new_iso_date`} for more information. |
| 23 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 24 |
*/ |
| 25 |
static create(year: i32, month: u8, day: u8): ICU4XIsoDate | never; |
| 26 |
|
| 27 |
/** |
| 28 |
|
| 29 |
* Creates a new {@link ICU4XIsoDate `ICU4XIsoDate`} representing January 1, 1970. |
| 30 |
|
| 31 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.unix_epoch Rust documentation for `unix_epoch`} for more information. |
| 32 |
*/ |
| 33 |
static create_for_unix_epoch(): ICU4XIsoDate; |
| 34 |
|
| 35 |
/** |
| 36 |
|
| 37 |
* Convert this date to one in a different calendar |
| 38 |
|
| 39 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_calendar Rust documentation for `to_calendar`} for more information. |
| 40 |
*/ |
| 41 |
to_calendar(calendar: ICU4XCalendar): ICU4XDate; |
| 42 |
|
| 43 |
/** |
| 44 |
|
| 45 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_any Rust documentation for `to_any`} for more information. |
| 46 |
*/ |
| 47 |
to_any(): ICU4XDate; |
| 48 |
|
| 49 |
/** |
| 50 |
|
| 51 |
* Returns the 1-indexed day in the year for this date |
| 52 |
|
| 53 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_year_info Rust documentation for `day_of_year_info`} for more information. |
| 54 |
*/ |
| 55 |
day_of_year(): u16; |
| 56 |
|
| 57 |
/** |
| 58 |
|
| 59 |
* Returns the 1-indexed day in the month for this date |
| 60 |
|
| 61 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month Rust documentation for `day_of_month`} for more information. |
| 62 |
*/ |
| 63 |
day_of_month(): u32; |
| 64 |
|
| 65 |
/** |
| 66 |
|
| 67 |
* Returns the day in the week for this day |
| 68 |
|
| 69 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week Rust documentation for `day_of_week`} for more information. |
| 70 |
*/ |
| 71 |
day_of_week(): ICU4XIsoWeekday; |
| 72 |
|
| 73 |
/** |
| 74 |
|
| 75 |
* Returns the week number in this month, 1-indexed, based on what is considered the first day of the week (often a locale preference). |
| 76 |
|
| 77 |
* `first_weekday` can be obtained via `first_weekday()` on {@link ICU4XWeekCalculator `ICU4XWeekCalculator`} |
| 78 |
|
| 79 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_month Rust documentation for `week_of_month`} for more information. |
| 80 |
*/ |
| 81 |
week_of_month(first_weekday: ICU4XIsoWeekday): u32; |
| 82 |
|
| 83 |
/** |
| 84 |
|
| 85 |
* Returns the week number in this year, using week data |
| 86 |
|
| 87 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year Rust documentation for `week_of_year`} for more information. |
| 88 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 89 |
*/ |
| 90 |
week_of_year(calculator: ICU4XWeekCalculator): ICU4XWeekOf | never; |
| 91 |
|
| 92 |
/** |
| 93 |
|
| 94 |
* Returns 1-indexed number of the month of this date in its year |
| 95 |
|
| 96 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month Rust documentation for `month`} for more information. |
| 97 |
*/ |
| 98 |
month(): u32; |
| 99 |
|
| 100 |
/** |
| 101 |
|
| 102 |
* Returns the year number for this date |
| 103 |
|
| 104 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year Rust documentation for `year`} for more information. |
| 105 |
*/ |
| 106 |
year(): i32; |
| 107 |
|
| 108 |
/** |
| 109 |
|
| 110 |
* Returns if the year is a leap year for this date |
| 111 |
|
| 112 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.is_in_leap_year Rust documentation for `is_in_leap_year`} for more information. |
| 113 |
*/ |
| 114 |
is_in_leap_year(): boolean; |
| 115 |
|
| 116 |
/** |
| 117 |
|
| 118 |
* Returns the number of months in the year represented by this date |
| 119 |
|
| 120 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year Rust documentation for `months_in_year`} for more information. |
| 121 |
*/ |
| 122 |
months_in_year(): u8; |
| 123 |
|
| 124 |
/** |
| 125 |
|
| 126 |
* Returns the number of days in the month represented by this date |
| 127 |
|
| 128 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month Rust documentation for `days_in_month`} for more information. |
| 129 |
*/ |
| 130 |
days_in_month(): u8; |
| 131 |
|
| 132 |
/** |
| 133 |
|
| 134 |
* Returns the number of days in the year represented by this date |
| 135 |
|
| 136 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year Rust documentation for `days_in_year`} for more information. |
| 137 |
*/ |
| 138 |
days_in_year(): u16; |
| 139 |
} |