| 1 |
import { u8, u16, i32, u32 } from "./diplomat-runtime" |
| 2 |
import { FFIError } from "./diplomat-runtime" |
| 3 |
import { ICU4XCalendar } from "./ICU4XCalendar"; |
| 4 |
import { ICU4XDateTime } from "./ICU4XDateTime"; |
| 5 |
import { ICU4XError } from "./ICU4XError"; |
| 6 |
import { ICU4XIsoDate } from "./ICU4XIsoDate"; |
| 7 |
import { ICU4XIsoWeekday } from "./ICU4XIsoWeekday"; |
| 8 |
import { ICU4XTime } from "./ICU4XTime"; |
| 9 |
import { ICU4XWeekCalculator } from "./ICU4XWeekCalculator"; |
| 10 |
import { ICU4XWeekOf } from "./ICU4XWeekOf"; |
| 11 |
|
| 12 |
/** |
| 13 |
|
| 14 |
* An ICU4X DateTime object capable of containing a ISO-8601 date and time. |
| 15 |
|
| 16 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html Rust documentation for `DateTime`} for more information. |
| 17 |
*/ |
| 18 |
export class ICU4XIsoDateTime { |
| 19 |
|
| 20 |
/** |
| 21 |
|
| 22 |
* Creates a new {@link ICU4XIsoDateTime `ICU4XIsoDateTime`} from the specified date and time. |
| 23 |
|
| 24 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.try_new_iso_datetime Rust documentation for `try_new_iso_datetime`} for more information. |
| 25 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 26 |
*/ |
| 27 |
static create(year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, nanosecond: u32): ICU4XIsoDateTime | never; |
| 28 |
|
| 29 |
/** |
| 30 |
|
| 31 |
* Creates a new {@link ICU4XIsoDateTime `ICU4XIsoDateTime`} from an {@link ICU4XIsoDate `ICU4XIsoDate`} and {@link ICU4XTime `ICU4XTime`} object |
| 32 |
|
| 33 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.new Rust documentation for `new`} for more information. |
| 34 |
*/ |
| 35 |
static crate_from_date_and_time(date: ICU4XIsoDate, time: ICU4XTime): ICU4XIsoDateTime; |
| 36 |
|
| 37 |
/** |
| 38 |
|
| 39 |
* Creates a new {@link ICU4XIsoDateTime `ICU4XIsoDateTime`} of midnight on January 1, 1970 |
| 40 |
|
| 41 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.local_unix_epoch Rust documentation for `local_unix_epoch`} for more information. |
| 42 |
*/ |
| 43 |
static local_unix_epoch(): ICU4XIsoDateTime; |
| 44 |
|
| 45 |
/** |
| 46 |
|
| 47 |
* Construct from the minutes since the local unix epoch for this date (Jan 1 1970, 00:00) |
| 48 |
|
| 49 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.from_minutes_since_local_unix_epoch Rust documentation for `from_minutes_since_local_unix_epoch`} for more information. |
| 50 |
*/ |
| 51 |
static create_from_minutes_since_local_unix_epoch(minutes: i32): ICU4XIsoDateTime; |
| 52 |
|
| 53 |
/** |
| 54 |
|
| 55 |
* Gets the date contained in this object |
| 56 |
|
| 57 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.date Rust documentation for `date`} for more information. |
| 58 |
*/ |
| 59 |
date(): ICU4XIsoDate; |
| 60 |
|
| 61 |
/** |
| 62 |
|
| 63 |
* Gets the time contained in this object |
| 64 |
|
| 65 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#structfield.time Rust documentation for `time`} for more information. |
| 66 |
*/ |
| 67 |
time(): ICU4XTime; |
| 68 |
|
| 69 |
/** |
| 70 |
|
| 71 |
* Converts this to an {@link ICU4XDateTime `ICU4XDateTime`} capable of being mixed with dates of other calendars |
| 72 |
|
| 73 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_any Rust documentation for `to_any`} for more information. |
| 74 |
*/ |
| 75 |
to_any(): ICU4XDateTime; |
| 76 |
|
| 77 |
/** |
| 78 |
|
| 79 |
* Gets the minutes since the local unix epoch for this date (Jan 1 1970, 00:00) |
| 80 |
|
| 81 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.minutes_since_local_unix_epoch Rust documentation for `minutes_since_local_unix_epoch`} for more information. |
| 82 |
*/ |
| 83 |
minutes_since_local_unix_epoch(): i32; |
| 84 |
|
| 85 |
/** |
| 86 |
|
| 87 |
* Convert this datetime to one in a different calendar |
| 88 |
|
| 89 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.DateTime.html#method.to_calendar Rust documentation for `to_calendar`} for more information. |
| 90 |
*/ |
| 91 |
to_calendar(calendar: ICU4XCalendar): ICU4XDateTime; |
| 92 |
|
| 93 |
/** |
| 94 |
|
| 95 |
* Returns the hour in this time |
| 96 |
|
| 97 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Time.html#structfield.hour Rust documentation for `hour`} for more information. |
| 98 |
*/ |
| 99 |
hour(): u8; |
| 100 |
|
| 101 |
/** |
| 102 |
|
| 103 |
* Returns the minute in this time |
| 104 |
|
| 105 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Time.html#structfield.minute Rust documentation for `minute`} for more information. |
| 106 |
*/ |
| 107 |
minute(): u8; |
| 108 |
|
| 109 |
/** |
| 110 |
|
| 111 |
* Returns the second in this time |
| 112 |
|
| 113 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Time.html#structfield.second Rust documentation for `second`} for more information. |
| 114 |
*/ |
| 115 |
second(): u8; |
| 116 |
|
| 117 |
/** |
| 118 |
|
| 119 |
* Returns the nanosecond in this time |
| 120 |
|
| 121 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Time.html#structfield.nanosecond Rust documentation for `nanosecond`} for more information. |
| 122 |
*/ |
| 123 |
nanosecond(): u32; |
| 124 |
|
| 125 |
/** |
| 126 |
|
| 127 |
* Returns the 1-indexed day in the year for this date |
| 128 |
|
| 129 |
* 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. |
| 130 |
*/ |
| 131 |
day_of_year(): u16; |
| 132 |
|
| 133 |
/** |
| 134 |
|
| 135 |
* Returns the 1-indexed day in the month for this date |
| 136 |
|
| 137 |
* 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. |
| 138 |
*/ |
| 139 |
day_of_month(): u32; |
| 140 |
|
| 141 |
/** |
| 142 |
|
| 143 |
* Returns the day in the week for this day |
| 144 |
|
| 145 |
* 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. |
| 146 |
*/ |
| 147 |
day_of_week(): ICU4XIsoWeekday; |
| 148 |
|
| 149 |
/** |
| 150 |
|
| 151 |
* Returns the week number in this month, 1-indexed, based on what is considered the first day of the week (often a locale preference). |
| 152 |
|
| 153 |
* `first_weekday` can be obtained via `first_weekday()` on {@link ICU4XWeekCalculator `ICU4XWeekCalculator`} |
| 154 |
|
| 155 |
* 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. |
| 156 |
*/ |
| 157 |
week_of_month(first_weekday: ICU4XIsoWeekday): u32; |
| 158 |
|
| 159 |
/** |
| 160 |
|
| 161 |
* Returns the week number in this year, using week data |
| 162 |
|
| 163 |
* 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. |
| 164 |
* @throws {@link FFIError}<{@link ICU4XError}> |
| 165 |
*/ |
| 166 |
week_of_year(calculator: ICU4XWeekCalculator): ICU4XWeekOf | never; |
| 167 |
|
| 168 |
/** |
| 169 |
|
| 170 |
* Returns 1-indexed number of the month of this date in its year |
| 171 |
|
| 172 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month Rust documentation for `month`} for more information. |
| 173 |
*/ |
| 174 |
month(): u32; |
| 175 |
|
| 176 |
/** |
| 177 |
|
| 178 |
* Returns the year number for this date |
| 179 |
|
| 180 |
* See the {@link https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year Rust documentation for `year`} for more information. |
| 181 |
*/ |
| 182 |
year(): i32; |
| 183 |
|
| 184 |
/** |
| 185 |
|
| 186 |
* Returns whether this date is in a leap year |
| 187 |
|
| 188 |
* 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. |
| 189 |
*/ |
| 190 |
is_in_leap_year(): boolean; |
| 191 |
|
| 192 |
/** |
| 193 |
|
| 194 |
* Returns the number of months in the year represented by this date |
| 195 |
|
| 196 |
* 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. |
| 197 |
*/ |
| 198 |
months_in_year(): u8; |
| 199 |
|
| 200 |
/** |
| 201 |
|
| 202 |
* Returns the number of days in the month represented by this date |
| 203 |
|
| 204 |
* 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. |
| 205 |
*/ |
| 206 |
days_in_month(): u8; |
| 207 |
|
| 208 |
/** |
| 209 |
|
| 210 |
* Returns the number of days in the year represented by this date |
| 211 |
|
| 212 |
* 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. |
| 213 |
*/ |
| 214 |
days_in_year(): u16; |
| 215 |
} |