Date.d.ts (7619B)
1 // generated by diplomat-tool 2 import type { Calendar } from "./Calendar" 3 import type { CalendarError } from "./CalendarError" 4 import type { IsoDate } from "./IsoDate" 5 import type { Rfc9557ParseError } from "./Rfc9557ParseError" 6 import type { Weekday } from "./Weekday" 7 import type { pointer, codepoint } from "./diplomat-runtime.d.ts"; 8 9 10 /** 11 * An ICU4X Date object capable of containing a date for any calendar. 12 * 13 * See the [Rust documentation for `Date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html) for more information. 14 */ 15 16 17 export class Date { 18 get ffiValue(): pointer; 19 20 21 /** 22 * Creates a new [`Date`] representing the ISO date 23 * given but in a given calendar 24 * 25 * See the [Rust documentation for `new_from_iso`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.new_from_iso) for more information. 26 */ 27 static fromIsoInCalendar(year: number, month: number, day: number, calendar: Calendar): Date; 28 29 /** 30 * Creates a new [`Date`] from the given codes, which are interpreted in the given calendar system 31 * 32 * An empty era code will treat the year as an extended year 33 * 34 * See the [Rust documentation for `try_new_from_codes`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_new_from_codes) for more information. 35 */ 36 static fromCodesInCalendar(eraCode: string, year: number, monthCode: string, day: number, calendar: Calendar): Date; 37 38 /** 39 * Creates a new [`Date`] from the given Rata Die 40 * 41 * See the [Rust documentation for `from_rata_die`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.from_rata_die) for more information. 42 */ 43 static fromRataDie(rd: bigint, calendar: Calendar): Date; 44 45 /** 46 * Creates a new [`Date`] from an IXDTF string. 47 * 48 * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_from_str) for more information. 49 */ 50 static fromString(v: string, calendar: Calendar): Date; 51 52 /** 53 * Convert this date to one in a different calendar 54 * 55 * See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_calendar) for more information. 56 */ 57 toCalendar(calendar: Calendar): Date; 58 59 /** 60 * Converts this date to ISO 61 * 62 * See the [Rust documentation for `to_iso`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_iso) for more information. 63 */ 64 toIso(): IsoDate; 65 66 /** 67 * Returns this date's Rata Die 68 * 69 * See the [Rust documentation for `to_rata_die`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_rata_die) for more information. 70 */ 71 get rataDie(): bigint; 72 73 /** 74 * Returns the 1-indexed day in the year for this date 75 * 76 * See the [Rust documentation for `day_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_year) for more information. 77 */ 78 get dayOfYear(): number; 79 80 /** 81 * Returns the 1-indexed day in the month for this date 82 * 83 * See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information. 84 */ 85 get dayOfMonth(): number; 86 87 /** 88 * Returns the day in the week for this day 89 * 90 * See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information. 91 */ 92 get dayOfWeek(): Weekday; 93 94 /** 95 * Returns 1-indexed number of the month of this date in its year 96 * 97 * Note that for lunar calendars this may not lead to the same month 98 * having the same ordinal month across years; use month_code if you care 99 * about month identity. 100 * 101 * See the [Rust documentation for `month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) for more information. 102 * 103 * See the [Rust documentation for `ordinal`](https://docs.rs/icu/latest/icu/calendar/types/struct.MonthInfo.html#structfield.ordinal) for more information. 104 */ 105 get ordinalMonth(): number; 106 107 /** 108 * Returns the month code for this date. Typically something 109 * like "M01", "M02", but can be more complicated for lunar calendars. 110 * 111 * See the [Rust documentation for `standard_code`](https://docs.rs/icu/latest/icu/calendar/types/struct.MonthInfo.html#structfield.standard_code) for more information. 112 * 113 * Additional information: [1](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) 114 */ 115 get monthCode(): string; 116 117 /** 118 * Returns the month number of this month. 119 * 120 * See the [Rust documentation for `month_number`](https://docs.rs/icu/latest/icu/calendar/types/struct.MonthInfo.html#method.month_number) for more information. 121 */ 122 get monthNumber(): number; 123 124 /** 125 * Returns whether the month is a leap month. 126 * 127 * See the [Rust documentation for `is_leap`](https://docs.rs/icu/latest/icu/calendar/types/struct.MonthInfo.html#method.is_leap) for more information. 128 */ 129 get monthIsLeap(): boolean; 130 131 /** 132 * Returns the year number in the current era for this date 133 * 134 * For calendars without an era, returns the related ISO year. 135 * 136 * See the [Rust documentation for `era_year_or_related_iso`](https://docs.rs/icu/latest/icu/calendar/types/enum.YearInfo.html#method.era_year_or_related_iso) for more information. 137 * 138 * Additional information: [1](https://docs.rs/icu/latest/icu/calendar/types/struct.EraYear.html#structfield.year), [2](https://docs.rs/icu/latest/icu/calendar/types/struct.CyclicYear.html#structfield.related_iso), [3](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) 139 */ 140 get eraYearOrRelatedIso(): number; 141 142 /** 143 * Returns the extended year in the Date 144 * 145 * See the [Rust documentation for `extended_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.extended_year) for more information. 146 */ 147 get extendedYear(): number; 148 149 /** 150 * Returns the era for this date, or an empty string 151 * 152 * See the [Rust documentation for `era`](https://docs.rs/icu/latest/icu/calendar/types/struct.EraYear.html#structfield.era) for more information. 153 * 154 * Additional information: [1](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) 155 */ 156 get era(): string; 157 158 /** 159 * Returns the number of months in the year represented by this date 160 * 161 * See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information. 162 */ 163 get monthsInYear(): number; 164 165 /** 166 * Returns the number of days in the month represented by this date 167 * 168 * See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information. 169 */ 170 get daysInMonth(): number; 171 172 /** 173 * Returns the number of days in the year represented by this date 174 * 175 * See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information. 176 */ 177 get daysInYear(): number; 178 179 /** 180 * Returns the [`Calendar`] object backing this date 181 * 182 * See the [Rust documentation for `calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.calendar) for more information. 183 */ 184 get calendar(): Calendar; 185 }