IsoDate.d.ts (4853B)
1 // generated by diplomat-tool 2 import type { Calendar } from "./Calendar" 3 import type { CalendarError } from "./CalendarError" 4 import type { Date } from "./Date" 5 import type { IsoWeekOfYear } from "./IsoWeekOfYear" 6 import type { Rfc9557ParseError } from "./Rfc9557ParseError" 7 import type { Weekday } from "./Weekday" 8 import type { pointer, codepoint } from "./diplomat-runtime.d.ts"; 9 10 11 /** 12 * An ICU4X Date object capable of containing a ISO-8601 date 13 * 14 * See the [Rust documentation for `Date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html) for more information. 15 */ 16 17 18 export class IsoDate { 19 get ffiValue(): pointer; 20 21 22 /** 23 * Creates a new [`IsoDate`] from the given Rata Die 24 * 25 * 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. 26 */ 27 static fromRataDie(rd: bigint): IsoDate; 28 29 /** 30 * Creates a new [`IsoDate`] from an IXDTF string. 31 * 32 * 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. 33 */ 34 static fromString(v: string): IsoDate; 35 36 /** 37 * Convert this date to one in a different calendar 38 * 39 * See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_calendar) for more information. 40 */ 41 toCalendar(calendar: Calendar): Date; 42 43 /** 44 * See the [Rust documentation for `to_any`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_any) for more information. 45 */ 46 toAny(): Date; 47 48 /** 49 * Returns this date's Rata Die 50 * 51 * 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. 52 */ 53 get rataDie(): bigint; 54 55 /** 56 * Returns the 1-indexed day in the year for this date 57 * 58 * 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. 59 */ 60 get dayOfYear(): number; 61 62 /** 63 * Returns the 1-indexed day in the month for this date 64 * 65 * 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. 66 */ 67 get dayOfMonth(): number; 68 69 /** 70 * Returns the day in the week for this day 71 * 72 * 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. 73 */ 74 get dayOfWeek(): Weekday; 75 76 /** 77 * Returns the week number in this year, using week data 78 * 79 * See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information. 80 */ 81 weekOfYear(): IsoWeekOfYear; 82 83 /** 84 * Returns 1-indexed number of the month of this date in its year 85 * 86 * See the [Rust documentation for `ordinal`](https://docs.rs/icu/latest/icu/calendar/types/struct.MonthInfo.html#structfield.ordinal) for more information. 87 * 88 * Additional information: [1](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month) 89 */ 90 get month(): number; 91 92 /** 93 * Returns the year number in the current era for this date 94 * 95 * For calendars without an era, returns the extended year 96 * 97 * See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information. 98 */ 99 get year(): number; 100 101 /** 102 * Returns if the year is a leap year for this date 103 * 104 * See the [Rust documentation for `is_in_leap_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.is_in_leap_year) for more information. 105 */ 106 get isInLeapYear(): boolean; 107 108 /** 109 * Returns the number of months in the year represented by this date 110 * 111 * 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. 112 */ 113 get monthsInYear(): number; 114 115 /** 116 * Returns the number of days in the month represented by this date 117 * 118 * 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. 119 */ 120 get daysInMonth(): number; 121 122 /** 123 * Returns the number of days in the year represented by this date 124 * 125 * 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. 126 */ 127 get daysInYear(): number; 128 129 constructor(year: number, month: number, day: number); 130 }