js_sys/Temporal.rs
1use super::*;
2
3/// Overflow handling mode for Temporal assignment operations.
4///
5/// Used by `from()` and `with()` methods on date/time types.
6#[wasm_bindgen]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Overflow {
9 /// Out-of-range values are clamped to the nearest in-range value.
10 Constrain = "constrain",
11 /// Out-of-range values will cause the function to throw a RangeError.
12 Reject = "reject",
13}
14
15/// Disambiguation mode for handling ambiguous times during DST transitions.
16///
17/// Used when converting `PlainDateTime` to `Instant` or `ZonedDateTime`.
18#[wasm_bindgen]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum Disambiguation {
21 /// Equivalent to `'earlier'` for backward transitions and `'later'` for forward transitions.
22 /// This matches the behavior of legacy `Date` and libraries like moment.js.
23 Compatible = "compatible",
24 /// The earlier time of two possible times.
25 Earlier = "earlier",
26 /// The later of two possible times.
27 Later = "later",
28 /// Throw a RangeError instead of resolving ambiguity.
29 Reject = "reject",
30}
31
32/// Offset disambiguation option for ZonedDateTime parsing and conversion.
33///
34/// Controls how to handle time zone offset changes when parsing or converting dates.
35#[wasm_bindgen]
36#[derive(Clone, Copy, Debug, PartialEq, Eq)]
37pub enum OffsetOption {
38 /// Always use the offset to calculate the instant.
39 Use = "use",
40 /// Use the offset if it's valid for the date/time, otherwise use the time zone.
41 Prefer = "prefer",
42 /// Disregard any provided offset and use the time zone.
43 Ignore = "ignore",
44 /// Throw a RangeError if the offset is not valid for the time zone.
45 Reject = "reject",
46}
47
48/// A date or time unit, as accepted by the `smallestUnit` and `unit` options.
49///
50/// Each method accepts only a subset of these; for example `Instant` methods
51/// reject calendar units and `toString()` accepts `Minute` and smaller only.
52/// Out-of-range units are reported as a `RangeError` by the engine.
53#[wasm_bindgen]
54#[derive(Clone, Copy, Debug, PartialEq, Eq)]
55pub enum Unit {
56 Year = "year",
57 Month = "month",
58 Week = "week",
59 Day = "day",
60 Hour = "hour",
61 Minute = "minute",
62 Second = "second",
63 Millisecond = "millisecond",
64 Microsecond = "microsecond",
65 Nanosecond = "nanosecond",
66}
67
68/// A date or time unit, or `Auto`, as accepted by the `largestUnit` option.
69#[wasm_bindgen]
70#[derive(Clone, Copy, Debug, PartialEq, Eq)]
71pub enum LargestUnit {
72 Auto = "auto",
73 Year = "year",
74 Month = "month",
75 Week = "week",
76 Day = "day",
77 Hour = "hour",
78 Minute = "minute",
79 Second = "second",
80 Millisecond = "millisecond",
81 Microsecond = "microsecond",
82 Nanosecond = "nanosecond",
83}
84
85/// Calendar display option for `toString()` methods.
86#[wasm_bindgen]
87#[derive(Clone, Copy, Debug, PartialEq, Eq)]
88pub enum CalendarDisplay {
89 /// Show calendar annotation only when it's not ISO 8601.
90 Auto = "auto",
91 /// Always show the calendar annotation.
92 Always = "always",
93 /// Never show the calendar annotation.
94 Never = "never",
95 /// Always show the calendar annotation with the critical flag.
96 Critical = "critical",
97}
98
99/// Time zone display option for `ZonedDateTime.toString()`.
100#[wasm_bindgen]
101#[derive(Clone, Copy, Debug, PartialEq, Eq)]
102pub enum TimeZoneDisplay {
103 /// Show time zone annotation.
104 Auto = "auto",
105 /// Never show the time zone annotation.
106 Never = "never",
107 /// Always show the time zone annotation with the critical flag.
108 Critical = "critical",
109}
110
111/// Offset display option for `ZonedDateTime.toString()`.
112#[wasm_bindgen]
113#[derive(Clone, Copy, Debug, PartialEq, Eq)]
114pub enum OffsetDisplay {
115 /// Show the offset.
116 Auto = "auto",
117 /// Never show the offset.
118 Never = "never",
119}
120
121/// Direction for `getTimeZoneTransition()`.
122#[wasm_bindgen]
123#[derive(Clone, Copy, Debug, PartialEq, Eq)]
124pub enum TransitionDirection {
125 /// Find the next time zone transition.
126 Next = "next",
127 /// Find the previous time zone transition.
128 Previous = "previous",
129}
130
131// OverflowOptions - for from(), with(), add() and subtract()
132#[wasm_bindgen]
133extern "C" {
134 /// The `overflow` option accepted by `from()`, `with()`, `add()` and `subtract()`.
135 ///
136 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/from#options)
137 #[wasm_bindgen(extends = Object)]
138 #[derive(Clone, Debug)]
139 pub type OverflowOptions;
140
141 /// Get the overflow handling mode.
142 #[wasm_bindgen(method, getter = overflow)]
143 pub fn get_overflow(this: &OverflowOptions) -> Option<Overflow>;
144
145 /// Set the overflow handling mode.
146 ///
147 /// - `'constrain'` (default): Out-of-range values are clamped to the nearest in-range value.
148 /// - `'reject'`: Out-of-range values will cause the function to throw a RangeError.
149 #[wasm_bindgen(method, setter = overflow)]
150 pub fn set_overflow(this: &OverflowOptions, value: Overflow);
151}
152
153impl OverflowOptions {
154 /// Creates a new `OverflowOptions` object.
155 pub fn new() -> OverflowOptions {
156 JsCast::unchecked_into(Object::new())
157 }
158}
159
160impl Default for OverflowOptions {
161 fn default() -> Self {
162 Self::new()
163 }
164}
165
166// DisambiguationOptions - for PlainDateTime.toZonedDateTime()
167#[wasm_bindgen]
168extern "C" {
169 /// The `disambiguation` option accepted by `PlainDateTime.toZonedDateTime()`.
170 ///
171 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toZonedDateTime#options)
172 #[wasm_bindgen(extends = Object)]
173 #[derive(Clone, Debug)]
174 pub type DisambiguationOptions;
175
176 /// Get the disambiguation mode.
177 #[wasm_bindgen(method, getter = disambiguation)]
178 pub fn get_disambiguation(this: &DisambiguationOptions) -> Option<Disambiguation>;
179
180 /// Set the disambiguation mode for handling ambiguous times.
181 ///
182 /// - `'compatible'` (default): Equivalent to `'earlier'` for backward transitions
183 /// and `'later'` for forward transitions.
184 /// - `'earlier'`: The earlier time of two possible times.
185 /// - `'later'`: The later of two possible times.
186 /// - `'reject'`: Throw a RangeError instead.
187 #[wasm_bindgen(method, setter = disambiguation)]
188 pub fn set_disambiguation(this: &DisambiguationOptions, value: Disambiguation);
189}
190
191impl DisambiguationOptions {
192 /// Creates a new `DisambiguationOptions` object.
193 pub fn new() -> DisambiguationOptions {
194 JsCast::unchecked_into(Object::new())
195 }
196}
197
198impl Default for DisambiguationOptions {
199 fn default() -> Self {
200 Self::new()
201 }
202}
203
204// ZonedDateTimeAssignmentOptions - for ZonedDateTime.from() and ZonedDateTime.with()
205#[wasm_bindgen]
206extern "C" {
207 /// Options for `ZonedDateTime.from()` and `ZonedDateTime.with()`.
208 ///
209 /// The `offset` option defaults to `'reject'` for `from()` and to
210 /// `'prefer'` for `with()`.
211 ///
212 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/from#options)
213 #[wasm_bindgen(extends = Object)]
214 #[derive(Clone, Debug)]
215 pub type ZonedDateTimeAssignmentOptions;
216
217 /// Get the overflow handling mode.
218 #[wasm_bindgen(method, getter = overflow)]
219 pub fn get_overflow(this: &ZonedDateTimeAssignmentOptions) -> Option<Overflow>;
220
221 /// Set the overflow handling mode.
222 #[wasm_bindgen(method, setter = overflow)]
223 pub fn set_overflow(this: &ZonedDateTimeAssignmentOptions, value: Overflow);
224
225 /// Get the disambiguation mode.
226 #[wasm_bindgen(method, getter = disambiguation)]
227 pub fn get_disambiguation(this: &ZonedDateTimeAssignmentOptions) -> Option<Disambiguation>;
228
229 /// Set the disambiguation mode.
230 #[wasm_bindgen(method, setter = disambiguation)]
231 pub fn set_disambiguation(this: &ZonedDateTimeAssignmentOptions, value: Disambiguation);
232
233 /// Get the offset option.
234 #[wasm_bindgen(method, getter = offset)]
235 pub fn get_offset(this: &ZonedDateTimeAssignmentOptions) -> Option<OffsetOption>;
236
237 /// Set the offset option.
238 #[wasm_bindgen(method, setter = offset)]
239 pub fn set_offset(this: &ZonedDateTimeAssignmentOptions, value: OffsetOption);
240}
241
242impl ZonedDateTimeAssignmentOptions {
243 /// Creates a new `ZonedDateTimeAssignmentOptions` object.
244 pub fn new() -> ZonedDateTimeAssignmentOptions {
245 JsCast::unchecked_into(Object::new())
246 }
247}
248
249impl Default for ZonedDateTimeAssignmentOptions {
250 fn default() -> Self {
251 Self::new()
252 }
253}
254
255// ToStringPrecisionOptions - base options for toString
256#[wasm_bindgen]
257extern "C" {
258 /// Options for outputting precision in `toString()` on types with seconds.
259 ///
260 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/toString#options)
261 #[wasm_bindgen(extends = Object)]
262 #[derive(Clone, Debug)]
263 pub type ToStringPrecisionOptions;
264
265 /// Get the fractional second digits option.
266 #[wasm_bindgen(method, getter = fractionalSecondDigits)]
267 pub fn get_fractional_second_digits(this: &ToStringPrecisionOptions) -> Option<u8>;
268
269 /// Set the number of fractional second digits to display, from 0 to 9.
270 ///
271 /// When unset, as many digits as needed to represent the value are shown.
272 #[wasm_bindgen(method, setter = fractionalSecondDigits)]
273 pub fn set_fractional_second_digits(this: &ToStringPrecisionOptions, value: u8);
274
275 /// Get the smallest unit option.
276 #[wasm_bindgen(method, getter = smallestUnit)]
277 pub fn get_smallest_unit(this: &ToStringPrecisionOptions) -> Option<Unit>;
278
279 /// Set the smallest unit to display.
280 #[wasm_bindgen(method, setter = smallestUnit)]
281 pub fn set_smallest_unit(this: &ToStringPrecisionOptions, value: Unit);
282
283 /// Get the rounding mode.
284 #[wasm_bindgen(method, getter = roundingMode)]
285 pub fn get_rounding_mode(this: &ToStringPrecisionOptions) -> Option<Intl::RoundingMode>;
286
287 /// Set the rounding mode.
288 #[wasm_bindgen(method, setter = roundingMode)]
289 pub fn set_rounding_mode(this: &ToStringPrecisionOptions, value: Intl::RoundingMode);
290}
291
292impl ToStringPrecisionOptions {
293 /// Creates a new `ToStringPrecisionOptions` object.
294 pub fn new() -> ToStringPrecisionOptions {
295 JsCast::unchecked_into(Object::new())
296 }
297}
298
299impl Default for ToStringPrecisionOptions {
300 fn default() -> Self {
301 Self::new()
302 }
303}
304
305// ShowCalendarOptions
306#[wasm_bindgen]
307extern "C" {
308 /// Options for showing calendar in `toString()` output.
309 ///
310 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toString#options)
311 #[wasm_bindgen(extends = Object)]
312 #[derive(Clone, Debug)]
313 pub type ShowCalendarOptions;
314
315 /// Get the calendar name display option.
316 #[wasm_bindgen(method, getter = calendarName)]
317 pub fn get_calendar_name(this: &ShowCalendarOptions) -> Option<CalendarDisplay>;
318
319 /// Set the calendar name display option.
320 ///
321 /// - `'auto'` (default): Show calendar only when it's not ISO 8601.
322 /// - `'always'`: Always show the calendar annotation.
323 /// - `'never'`: Never show the calendar annotation.
324 /// - `'critical'`: Always show with the critical flag.
325 #[wasm_bindgen(method, setter = calendarName)]
326 pub fn set_calendar_name(this: &ShowCalendarOptions, value: CalendarDisplay);
327}
328
329impl ShowCalendarOptions {
330 /// Creates a new `ShowCalendarOptions` object.
331 pub fn new() -> ShowCalendarOptions {
332 JsCast::unchecked_into(Object::new())
333 }
334}
335
336impl Default for ShowCalendarOptions {
337 fn default() -> Self {
338 Self::new()
339 }
340}
341
342// CalendarTypeToStringOptions - extends ToStringPrecisionOptions with calendar option
343#[wasm_bindgen]
344extern "C" {
345 /// Options for `toString()` on calendar types (PlainDateTime, PlainDate, etc.).
346 ///
347 /// Extends `ToStringPrecisionOptions` with calendar display option.
348 #[wasm_bindgen(extends = ToStringPrecisionOptions)]
349 #[derive(Clone, Debug)]
350 pub type CalendarTypeToStringOptions;
351
352 /// Get the calendar name display option.
353 #[wasm_bindgen(method, getter = calendarName)]
354 pub fn get_calendar_name(this: &CalendarTypeToStringOptions) -> Option<CalendarDisplay>;
355
356 /// Set the calendar name display option.
357 #[wasm_bindgen(method, setter = calendarName)]
358 pub fn set_calendar_name(this: &CalendarTypeToStringOptions, value: CalendarDisplay);
359}
360
361impl CalendarTypeToStringOptions {
362 /// Creates a new `CalendarTypeToStringOptions` object.
363 pub fn new() -> CalendarTypeToStringOptions {
364 JsCast::unchecked_into(Object::new())
365 }
366}
367
368impl Default for CalendarTypeToStringOptions {
369 fn default() -> Self {
370 Self::new()
371 }
372}
373
374// ZonedDateTimeToStringOptions - extends CalendarTypeToStringOptions
375#[wasm_bindgen]
376extern "C" {
377 /// Options for `ZonedDateTime.toString()`.
378 ///
379 /// Extends `CalendarTypeToStringOptions` with time zone and offset display options.
380 ///
381 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toString#options)
382 #[wasm_bindgen(extends = CalendarTypeToStringOptions)]
383 #[derive(Clone, Debug)]
384 pub type ZonedDateTimeToStringOptions;
385
386 /// Get the time zone name display option.
387 #[wasm_bindgen(method, getter = timeZoneName)]
388 pub fn get_time_zone_name(this: &ZonedDateTimeToStringOptions) -> Option<TimeZoneDisplay>;
389
390 /// Set the time zone name display option.
391 ///
392 /// - `'auto'` (default): Show the time zone annotation.
393 /// - `'never'`: Never show the time zone annotation.
394 /// - `'critical'`: Always show with the critical flag.
395 #[wasm_bindgen(method, setter = timeZoneName)]
396 pub fn set_time_zone_name(this: &ZonedDateTimeToStringOptions, value: TimeZoneDisplay);
397
398 /// Get the offset display option.
399 #[wasm_bindgen(method, getter = offset)]
400 pub fn get_offset(this: &ZonedDateTimeToStringOptions) -> Option<OffsetDisplay>;
401
402 /// Set the offset display option.
403 ///
404 /// - `'auto'` (default): Show the offset.
405 /// - `'never'`: Never show the offset.
406 #[wasm_bindgen(method, setter = offset)]
407 pub fn set_offset(this: &ZonedDateTimeToStringOptions, value: OffsetDisplay);
408}
409
410impl ZonedDateTimeToStringOptions {
411 /// Creates a new `ZonedDateTimeToStringOptions` object.
412 pub fn new() -> ZonedDateTimeToStringOptions {
413 JsCast::unchecked_into(Object::new())
414 }
415}
416
417impl Default for ZonedDateTimeToStringOptions {
418 fn default() -> Self {
419 Self::new()
420 }
421}
422
423// InstantToStringOptions
424#[wasm_bindgen]
425extern "C" {
426 /// Options for `Instant.toString()`.
427 ///
428 /// Extends `ToStringPrecisionOptions` with optional time zone.
429 ///
430 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/toString#options)
431 #[wasm_bindgen(extends = ToStringPrecisionOptions)]
432 #[derive(Clone, Debug)]
433 pub type InstantToStringOptions;
434
435 /// The `timeZone` for display as set: a string or the `Temporal.ZonedDateTime` it was taken from.
436 #[wasm_bindgen(method, getter = timeZone)]
437 pub fn get_time_zone(this: &InstantToStringOptions) -> Option<JsValue>;
438
439 /// Set the time zone for display.
440 ///
441 /// If provided, the output will show the wall-clock time in that time zone
442 /// with its offset, instead of just 'Z'.
443 #[wasm_bindgen(method, setter = timeZone)]
444 pub fn set_time_zone(this: &InstantToStringOptions, value: &str);
445 /// Sets `timeZone` to the time zone of the given `Temporal.ZonedDateTime`.
446 #[wasm_bindgen(method, setter = timeZone)]
447 pub fn set_time_zone_with_zoned_date_time(this: &InstantToStringOptions, value: &ZonedDateTime);
448}
449
450impl InstantToStringOptions {
451 /// Creates a new `InstantToStringOptions` object.
452 pub fn new() -> InstantToStringOptions {
453 JsCast::unchecked_into(Object::new())
454 }
455}
456
457impl Default for InstantToStringOptions {
458 fn default() -> Self {
459 Self::new()
460 }
461}
462
463// DifferenceOptions - for until() and since()
464#[wasm_bindgen]
465extern "C" {
466 /// Options to control the result of `until()` and `since()` methods.
467 ///
468 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/until#options)
469 #[wasm_bindgen(extends = Object)]
470 #[derive(Clone, Debug)]
471 pub type DifferenceOptions;
472
473 /// Get the smallest unit option.
474 #[wasm_bindgen(method, getter = smallestUnit)]
475 pub fn get_smallest_unit(this: &DifferenceOptions) -> Option<Unit>;
476
477 /// Set the smallest unit to round to.
478 #[wasm_bindgen(method, setter = smallestUnit)]
479 pub fn set_smallest_unit(this: &DifferenceOptions, value: Unit);
480
481 /// Get the largest unit option.
482 #[wasm_bindgen(method, getter = largestUnit)]
483 pub fn get_largest_unit(this: &DifferenceOptions) -> Option<LargestUnit>;
484
485 /// Set the largest unit to allow in the result.
486 ///
487 /// Larger units will be "balanced" into smaller units.
488 #[wasm_bindgen(method, setter = largestUnit)]
489 pub fn set_largest_unit(this: &DifferenceOptions, value: LargestUnit);
490
491 /// Get the rounding increment.
492 #[wasm_bindgen(method, getter = roundingIncrement)]
493 pub fn get_rounding_increment(this: &DifferenceOptions) -> Option<u32>;
494
495 /// Set the rounding increment.
496 ///
497 /// Allows rounding to an integer number of units.
498 #[wasm_bindgen(method, setter = roundingIncrement)]
499 pub fn set_rounding_increment(this: &DifferenceOptions, value: u32);
500
501 /// Get the rounding mode.
502 #[wasm_bindgen(method, getter = roundingMode)]
503 pub fn get_rounding_mode(this: &DifferenceOptions) -> Option<Intl::RoundingMode>;
504
505 /// Set the rounding mode.
506 #[wasm_bindgen(method, setter = roundingMode)]
507 pub fn set_rounding_mode(this: &DifferenceOptions, value: Intl::RoundingMode);
508}
509
510impl DifferenceOptions {
511 /// Creates a new `DifferenceOptions` object.
512 pub fn new() -> DifferenceOptions {
513 JsCast::unchecked_into(Object::new())
514 }
515}
516
517impl Default for DifferenceOptions {
518 fn default() -> Self {
519 Self::new()
520 }
521}
522
523// RoundToOptions - for round() methods
524#[wasm_bindgen]
525extern "C" {
526 /// Options for `round()` methods on Temporal types.
527 ///
528 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/round#options)
529 #[wasm_bindgen(extends = Object)]
530 #[derive(Clone, Debug)]
531 pub type RoundToOptions;
532
533 /// Get the smallest unit option.
534 #[wasm_bindgen(method, getter = smallestUnit)]
535 pub fn get_smallest_unit(this: &RoundToOptions) -> Unit;
536
537 /// Set the unit to round to. This option is required.
538 #[wasm_bindgen(method, setter = smallestUnit)]
539 pub fn set_smallest_unit(this: &RoundToOptions, value: Unit);
540
541 /// Get the rounding increment.
542 #[wasm_bindgen(method, getter = roundingIncrement)]
543 pub fn get_rounding_increment(this: &RoundToOptions) -> Option<u32>;
544
545 /// Set the rounding increment.
546 #[wasm_bindgen(method, setter = roundingIncrement)]
547 pub fn set_rounding_increment(this: &RoundToOptions, value: u32);
548
549 /// Get the rounding mode.
550 #[wasm_bindgen(method, getter = roundingMode)]
551 pub fn get_rounding_mode(this: &RoundToOptions) -> Option<Intl::RoundingMode>;
552
553 /// Set the rounding mode. Default is `'halfExpand'`.
554 #[wasm_bindgen(method, setter = roundingMode)]
555 pub fn set_rounding_mode(this: &RoundToOptions, value: Intl::RoundingMode);
556}
557
558impl RoundToOptions {
559 /// Creates `round()` options with the required `smallestUnit`.
560 pub fn new(smallest_unit: Unit) -> RoundToOptions {
561 let options: RoundToOptions = JsCast::unchecked_into(Object::new());
562 options.set_smallest_unit(smallest_unit);
563 options
564 }
565}
566
567// RelativeToOptions - for Duration.compare(), extended by the round() and total() options
568#[wasm_bindgen]
569extern "C" {
570 /// The `relativeTo` option, accepted by `Duration.compare()` directly and
571 /// through the `round()` and `total()` options which extend this type.
572 ///
573 /// It is required when the operation involves weeks or larger units, whose
574 /// lengths depend on the calendar date. It accepts a `PlainDate`,
575 /// `PlainDateTime` or `ZonedDateTime`, or a string or property bag
576 /// convertible to one.
577 ///
578 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/compare#options)
579 #[wasm_bindgen(extends = Object)]
580 #[derive(Clone, Debug)]
581 pub type RelativeToOptions;
582
583 /// Get the relativeTo option.
584 #[wasm_bindgen(method, getter = relativeTo)]
585 pub fn get_relative_to(this: &RelativeToOptions) -> Option<JsValue>;
586
587 #[wasm_bindgen(method, setter = relativeTo)]
588 pub fn set_relative_to_with_str(this: &RelativeToOptions, value: &str);
589 #[wasm_bindgen(method, setter = relativeTo)]
590 pub fn set_relative_to_with_plain_date_like(this: &RelativeToOptions, value: &PlainDateLike);
591 #[wasm_bindgen(method, setter = relativeTo)]
592 pub fn set_relative_to_with_plain_date_time_like(
593 this: &RelativeToOptions,
594 value: &PlainDateTimeLike,
595 );
596 #[wasm_bindgen(method, setter = relativeTo)]
597 pub fn set_relative_to_with_zoned_date_time_like(
598 this: &RelativeToOptions,
599 value: &ZonedDateTimeLike,
600 );
601 #[wasm_bindgen(method, setter = relativeTo)]
602 pub fn set_relative_to_with_plain_date(this: &RelativeToOptions, value: &PlainDate);
603 #[wasm_bindgen(method, setter = relativeTo)]
604 pub fn set_relative_to_with_plain_date_time(this: &RelativeToOptions, value: &PlainDateTime);
605 #[wasm_bindgen(method, setter = relativeTo)]
606 pub fn set_relative_to_with_zoned_date_time(this: &RelativeToOptions, value: &ZonedDateTime);
607}
608
609impl RelativeToOptions {
610 /// Creates a new `RelativeToOptions` object.
611 pub fn new() -> RelativeToOptions {
612 JsCast::unchecked_into(Object::new())
613 }
614}
615
616impl Default for RelativeToOptions {
617 fn default() -> Self {
618 Self::new()
619 }
620}
621
622// DurationRoundToOptions - for Duration.round()
623#[wasm_bindgen]
624extern "C" {
625 /// Options for `Duration.round()`.
626 ///
627 /// Either `smallestUnit` or `largestUnit` must be provided.
628 ///
629 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/round#options)
630 #[wasm_bindgen(extends = RelativeToOptions)]
631 #[derive(Clone, Debug)]
632 pub type DurationRoundToOptions;
633
634 /// Get the smallest unit option.
635 #[wasm_bindgen(method, getter = smallestUnit)]
636 pub fn get_smallest_unit(this: &DurationRoundToOptions) -> Option<Unit>;
637
638 /// Set the unit to round to.
639 #[wasm_bindgen(method, setter = smallestUnit)]
640 pub fn set_smallest_unit(this: &DurationRoundToOptions, value: Unit);
641
642 /// Get the largest unit option.
643 #[wasm_bindgen(method, getter = largestUnit)]
644 pub fn get_largest_unit(this: &DurationRoundToOptions) -> Option<LargestUnit>;
645
646 /// Set the largest unit to allow in the result.
647 #[wasm_bindgen(method, setter = largestUnit)]
648 pub fn set_largest_unit(this: &DurationRoundToOptions, value: LargestUnit);
649
650 /// Get the rounding increment.
651 #[wasm_bindgen(method, getter = roundingIncrement)]
652 pub fn get_rounding_increment(this: &DurationRoundToOptions) -> Option<u32>;
653
654 /// Set the rounding increment.
655 #[wasm_bindgen(method, setter = roundingIncrement)]
656 pub fn set_rounding_increment(this: &DurationRoundToOptions, value: u32);
657
658 /// Get the rounding mode.
659 #[wasm_bindgen(method, getter = roundingMode)]
660 pub fn get_rounding_mode(this: &DurationRoundToOptions) -> Option<Intl::RoundingMode>;
661
662 /// Set the rounding mode.
663 #[wasm_bindgen(method, setter = roundingMode)]
664 pub fn set_rounding_mode(this: &DurationRoundToOptions, value: Intl::RoundingMode);
665
666}
667
668impl DurationRoundToOptions {
669 /// Creates a new `DurationRoundToOptions` object.
670 pub fn new() -> DurationRoundToOptions {
671 JsCast::unchecked_into(Object::new())
672 }
673}
674
675impl Default for DurationRoundToOptions {
676 fn default() -> Self {
677 Self::new()
678 }
679}
680
681// DurationTotalOptions - for Duration.total()
682#[wasm_bindgen]
683extern "C" {
684 /// Options for `Duration.total()`.
685 ///
686 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/total#options)
687 #[wasm_bindgen(extends = RelativeToOptions)]
688 #[derive(Clone, Debug)]
689 pub type DurationTotalOptions;
690
691 /// Get the unit option.
692 #[wasm_bindgen(method, getter = unit)]
693 pub fn get_unit(this: &DurationTotalOptions) -> Unit;
694
695 /// Set the unit to convert the duration to. This option is required.
696 #[wasm_bindgen(method, setter = unit)]
697 pub fn set_unit(this: &DurationTotalOptions, value: Unit);
698
699}
700
701impl DurationTotalOptions {
702 /// Creates `total()` options with the required `unit`.
703 pub fn new(unit: Unit) -> DurationTotalOptions {
704 let options: DurationTotalOptions = JsCast::unchecked_into(Object::new());
705 options.set_unit(unit);
706 options
707 }
708}
709
710// TimeZoneTransitionOptions - for getTimeZoneTransition()
711#[wasm_bindgen]
712extern "C" {
713 /// Options for `ZonedDateTime.getTimeZoneTransition()`.
714 ///
715 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/getTimeZoneTransition)
716 #[wasm_bindgen(extends = Object)]
717 #[derive(Clone, Debug)]
718 pub type TimeZoneTransitionOptions;
719
720 /// Get the direction option.
721 #[wasm_bindgen(method, getter = direction)]
722 pub fn get_direction(this: &TimeZoneTransitionOptions) -> TransitionDirection;
723
724 /// Set the direction to search for transitions.
725 ///
726 /// - `'next'`: Find the next time zone transition.
727 /// - `'previous'`: Find the previous time zone transition.
728 #[wasm_bindgen(method, setter = direction)]
729 pub fn set_direction(this: &TimeZoneTransitionOptions, value: TransitionDirection);
730}
731
732impl TimeZoneTransitionOptions {
733 /// Creates `getTimeZoneTransition()` options with the required `direction`.
734 pub fn new(direction: TransitionDirection) -> TimeZoneTransitionOptions {
735 let options: TimeZoneTransitionOptions = JsCast::unchecked_into(Object::new());
736 options.set_direction(direction);
737 options
738 }
739}
740
741#[wasm_bindgen]
742extern "C" {
743 /// The date fields accepted by `PlainDate.with()`, `PlainMonthDay.with()` and the
744 /// `toPlainDate()` methods: `era`/`era_year`, `year`, `month`/`month_code` and `day`,
745 /// each optional.
746 #[wasm_bindgen(extends = Object)]
747 #[derive(Clone, Debug)]
748 pub type PlainDateFields;
749 #[wasm_bindgen(method, getter = era)]
750 pub fn get_era(this: &PlainDateFields) -> Option<JsString>;
751 #[wasm_bindgen(method, setter = era)]
752 pub fn set_era(this: &PlainDateFields, value: &str);
753 #[wasm_bindgen(method, getter = eraYear)]
754 pub fn get_era_year(this: &PlainDateFields) -> Option<i32>;
755 #[wasm_bindgen(method, setter = eraYear)]
756 pub fn set_era_year(this: &PlainDateFields, value: i32);
757 #[wasm_bindgen(method, getter = year)]
758 pub fn get_year(this: &PlainDateFields) -> Option<i32>;
759 #[wasm_bindgen(method, setter = year)]
760 pub fn set_year(this: &PlainDateFields, value: i32);
761 #[wasm_bindgen(method, getter = month)]
762 pub fn get_month(this: &PlainDateFields) -> Option<u32>;
763 #[wasm_bindgen(method, setter = month)]
764 pub fn set_month(this: &PlainDateFields, value: u32);
765 #[wasm_bindgen(method, getter = monthCode)]
766 pub fn get_month_code(this: &PlainDateFields) -> Option<JsString>;
767 #[wasm_bindgen(method, setter = monthCode)]
768 pub fn set_month_code(this: &PlainDateFields, value: &str);
769 #[wasm_bindgen(method, getter = day)]
770 pub fn get_day(this: &PlainDateFields) -> Option<u32>;
771 #[wasm_bindgen(method, setter = day)]
772 pub fn set_day(this: &PlainDateFields, value: u32);
773}
774
775impl PlainDateFields {
776 /// Creates an empty `PlainDateFields`.
777 pub fn new() -> PlainDateFields {
778 JsCast::unchecked_into(Object::new())
779 }
780}
781
782impl Default for PlainDateFields {
783 fn default() -> Self {
784 Self::new()
785 }
786}
787
788#[wasm_bindgen]
789extern "C" {
790 /// The property bag accepted by `PlainDate.from()`: the `PlainDateFields` plus
791 /// `calendar`. `from()` requires `year` (or `era` and `era_year`), `month` (or `month_code`) and `day`.
792 #[wasm_bindgen(extends = PlainDateFields)]
793 #[derive(Clone, Debug)]
794 pub type PlainDateLike;
795 /// The `calendar` as set: a string or the Temporal object it was taken from.
796 #[wasm_bindgen(method, getter = calendar)]
797 pub fn get_calendar(this: &PlainDateLike) -> Option<JsValue>;
798 #[wasm_bindgen(method, setter = calendar)]
799 pub fn set_calendar(this: &PlainDateLike, value: &str);
800 /// Sets `calendar` to the calendar of the given `Temporal.PlainDate`.
801 #[wasm_bindgen(method, setter = calendar)]
802 pub fn set_calendar_with_plain_date(this: &PlainDateLike, value: &PlainDate);
803 /// Sets `calendar` to the calendar of the given `Temporal.PlainDateTime`.
804 #[wasm_bindgen(method, setter = calendar)]
805 pub fn set_calendar_with_plain_date_time(this: &PlainDateLike, value: &PlainDateTime);
806 /// Sets `calendar` to the calendar of the given `Temporal.PlainYearMonth`.
807 #[wasm_bindgen(method, setter = calendar)]
808 pub fn set_calendar_with_plain_year_month(this: &PlainDateLike, value: &PlainYearMonth);
809 /// Sets `calendar` to the calendar of the given `Temporal.PlainMonthDay`.
810 #[wasm_bindgen(method, setter = calendar)]
811 pub fn set_calendar_with_plain_month_day(this: &PlainDateLike, value: &PlainMonthDay);
812 /// Sets `calendar` to the calendar of the given `Temporal.ZonedDateTime`.
813 #[wasm_bindgen(method, setter = calendar)]
814 pub fn set_calendar_with_zoned_date_time(this: &PlainDateLike, value: &ZonedDateTime);
815}
816
817impl PlainDateLike {
818 /// Creates an empty `PlainDateLike`.
819 pub fn new() -> PlainDateLike {
820 JsCast::unchecked_into(Object::new())
821 }
822}
823
824impl Default for PlainDateLike {
825 fn default() -> Self {
826 Self::new()
827 }
828}
829
830#[wasm_bindgen]
831extern "C" {
832 /// The time fields accepted by `PlainTime.from()` and `with()`, each optional.
833 /// `from()` requires at least one of them.
834 #[wasm_bindgen(extends = Object)]
835 #[derive(Clone, Debug)]
836 pub type PlainTimeLike;
837 #[wasm_bindgen(method, getter = hour)]
838 pub fn get_hour(this: &PlainTimeLike) -> Option<u32>;
839 #[wasm_bindgen(method, setter = hour)]
840 pub fn set_hour(this: &PlainTimeLike, value: u32);
841 #[wasm_bindgen(method, getter = minute)]
842 pub fn get_minute(this: &PlainTimeLike) -> Option<u32>;
843 #[wasm_bindgen(method, setter = minute)]
844 pub fn set_minute(this: &PlainTimeLike, value: u32);
845 #[wasm_bindgen(method, getter = second)]
846 pub fn get_second(this: &PlainTimeLike) -> Option<u32>;
847 #[wasm_bindgen(method, setter = second)]
848 pub fn set_second(this: &PlainTimeLike, value: u32);
849 #[wasm_bindgen(method, getter = millisecond)]
850 pub fn get_millisecond(this: &PlainTimeLike) -> Option<u32>;
851 #[wasm_bindgen(method, setter = millisecond)]
852 pub fn set_millisecond(this: &PlainTimeLike, value: u32);
853 #[wasm_bindgen(method, getter = microsecond)]
854 pub fn get_microsecond(this: &PlainTimeLike) -> Option<u32>;
855 #[wasm_bindgen(method, setter = microsecond)]
856 pub fn set_microsecond(this: &PlainTimeLike, value: u32);
857 #[wasm_bindgen(method, getter = nanosecond)]
858 pub fn get_nanosecond(this: &PlainTimeLike) -> Option<u32>;
859 #[wasm_bindgen(method, setter = nanosecond)]
860 pub fn set_nanosecond(this: &PlainTimeLike, value: u32);
861}
862
863impl PlainTimeLike {
864 /// Creates an empty `PlainTimeLike`.
865 pub fn new() -> PlainTimeLike {
866 JsCast::unchecked_into(Object::new())
867 }
868}
869
870impl Default for PlainTimeLike {
871 fn default() -> Self {
872 Self::new()
873 }
874}
875
876#[wasm_bindgen]
877extern "C" {
878 /// The date and time fields accepted by `PlainDateTime.with()`, each optional.
879 #[wasm_bindgen(extends = Object)]
880 #[derive(Clone, Debug)]
881 pub type PlainDateTimeFields;
882 #[wasm_bindgen(method, getter = era)]
883 pub fn get_era(this: &PlainDateTimeFields) -> Option<JsString>;
884 #[wasm_bindgen(method, setter = era)]
885 pub fn set_era(this: &PlainDateTimeFields, value: &str);
886 #[wasm_bindgen(method, getter = eraYear)]
887 pub fn get_era_year(this: &PlainDateTimeFields) -> Option<i32>;
888 #[wasm_bindgen(method, setter = eraYear)]
889 pub fn set_era_year(this: &PlainDateTimeFields, value: i32);
890 #[wasm_bindgen(method, getter = year)]
891 pub fn get_year(this: &PlainDateTimeFields) -> Option<i32>;
892 #[wasm_bindgen(method, setter = year)]
893 pub fn set_year(this: &PlainDateTimeFields, value: i32);
894 #[wasm_bindgen(method, getter = month)]
895 pub fn get_month(this: &PlainDateTimeFields) -> Option<u32>;
896 #[wasm_bindgen(method, setter = month)]
897 pub fn set_month(this: &PlainDateTimeFields, value: u32);
898 #[wasm_bindgen(method, getter = monthCode)]
899 pub fn get_month_code(this: &PlainDateTimeFields) -> Option<JsString>;
900 #[wasm_bindgen(method, setter = monthCode)]
901 pub fn set_month_code(this: &PlainDateTimeFields, value: &str);
902 #[wasm_bindgen(method, getter = day)]
903 pub fn get_day(this: &PlainDateTimeFields) -> Option<u32>;
904 #[wasm_bindgen(method, setter = day)]
905 pub fn set_day(this: &PlainDateTimeFields, value: u32);
906 #[wasm_bindgen(method, getter = hour)]
907 pub fn get_hour(this: &PlainDateTimeFields) -> Option<u32>;
908 #[wasm_bindgen(method, setter = hour)]
909 pub fn set_hour(this: &PlainDateTimeFields, value: u32);
910 #[wasm_bindgen(method, getter = minute)]
911 pub fn get_minute(this: &PlainDateTimeFields) -> Option<u32>;
912 #[wasm_bindgen(method, setter = minute)]
913 pub fn set_minute(this: &PlainDateTimeFields, value: u32);
914 #[wasm_bindgen(method, getter = second)]
915 pub fn get_second(this: &PlainDateTimeFields) -> Option<u32>;
916 #[wasm_bindgen(method, setter = second)]
917 pub fn set_second(this: &PlainDateTimeFields, value: u32);
918 #[wasm_bindgen(method, getter = millisecond)]
919 pub fn get_millisecond(this: &PlainDateTimeFields) -> Option<u32>;
920 #[wasm_bindgen(method, setter = millisecond)]
921 pub fn set_millisecond(this: &PlainDateTimeFields, value: u32);
922 #[wasm_bindgen(method, getter = microsecond)]
923 pub fn get_microsecond(this: &PlainDateTimeFields) -> Option<u32>;
924 #[wasm_bindgen(method, setter = microsecond)]
925 pub fn set_microsecond(this: &PlainDateTimeFields, value: u32);
926 #[wasm_bindgen(method, getter = nanosecond)]
927 pub fn get_nanosecond(this: &PlainDateTimeFields) -> Option<u32>;
928 #[wasm_bindgen(method, setter = nanosecond)]
929 pub fn set_nanosecond(this: &PlainDateTimeFields, value: u32);
930}
931
932impl PlainDateTimeFields {
933 /// Creates an empty `PlainDateTimeFields`.
934 pub fn new() -> PlainDateTimeFields {
935 JsCast::unchecked_into(Object::new())
936 }
937}
938
939impl Default for PlainDateTimeFields {
940 fn default() -> Self {
941 Self::new()
942 }
943}
944
945#[wasm_bindgen]
946extern "C" {
947 /// The property bag accepted by `PlainDateTime.from()`: the `PlainDateTimeFields`
948 /// plus `calendar`. `from()` requires `year` (or `era` and `era_year`), `month` (or `month_code`) and `day`.
949 /// Omitted time fields default to zero.
950 #[wasm_bindgen(extends = PlainDateTimeFields)]
951 #[derive(Clone, Debug)]
952 pub type PlainDateTimeLike;
953 /// The `calendar` as set: a string or the Temporal object it was taken from.
954 #[wasm_bindgen(method, getter = calendar)]
955 pub fn get_calendar(this: &PlainDateTimeLike) -> Option<JsValue>;
956 #[wasm_bindgen(method, setter = calendar)]
957 pub fn set_calendar(this: &PlainDateTimeLike, value: &str);
958 /// Sets `calendar` to the calendar of the given `Temporal.PlainDate`.
959 #[wasm_bindgen(method, setter = calendar)]
960 pub fn set_calendar_with_plain_date(this: &PlainDateTimeLike, value: &PlainDate);
961 /// Sets `calendar` to the calendar of the given `Temporal.PlainDateTime`.
962 #[wasm_bindgen(method, setter = calendar)]
963 pub fn set_calendar_with_plain_date_time(this: &PlainDateTimeLike, value: &PlainDateTime);
964 /// Sets `calendar` to the calendar of the given `Temporal.PlainYearMonth`.
965 #[wasm_bindgen(method, setter = calendar)]
966 pub fn set_calendar_with_plain_year_month(this: &PlainDateTimeLike, value: &PlainYearMonth);
967 /// Sets `calendar` to the calendar of the given `Temporal.PlainMonthDay`.
968 #[wasm_bindgen(method, setter = calendar)]
969 pub fn set_calendar_with_plain_month_day(this: &PlainDateTimeLike, value: &PlainMonthDay);
970 /// Sets `calendar` to the calendar of the given `Temporal.ZonedDateTime`.
971 #[wasm_bindgen(method, setter = calendar)]
972 pub fn set_calendar_with_zoned_date_time(this: &PlainDateTimeLike, value: &ZonedDateTime);
973}
974
975impl PlainDateTimeLike {
976 /// Creates an empty `PlainDateTimeLike`.
977 pub fn new() -> PlainDateTimeLike {
978 JsCast::unchecked_into(Object::new())
979 }
980}
981
982impl Default for PlainDateTimeLike {
983 fn default() -> Self {
984 Self::new()
985 }
986}
987
988#[wasm_bindgen]
989extern "C" {
990 /// The date, time and `offset` fields accepted by `ZonedDateTime.with()`, each
991 /// optional.
992 #[wasm_bindgen(extends = Object)]
993 #[derive(Clone, Debug)]
994 pub type ZonedDateTimeFields;
995 #[wasm_bindgen(method, getter = era)]
996 pub fn get_era(this: &ZonedDateTimeFields) -> Option<JsString>;
997 #[wasm_bindgen(method, setter = era)]
998 pub fn set_era(this: &ZonedDateTimeFields, value: &str);
999 #[wasm_bindgen(method, getter = eraYear)]
1000 pub fn get_era_year(this: &ZonedDateTimeFields) -> Option<i32>;
1001 #[wasm_bindgen(method, setter = eraYear)]
1002 pub fn set_era_year(this: &ZonedDateTimeFields, value: i32);
1003 #[wasm_bindgen(method, getter = year)]
1004 pub fn get_year(this: &ZonedDateTimeFields) -> Option<i32>;
1005 #[wasm_bindgen(method, setter = year)]
1006 pub fn set_year(this: &ZonedDateTimeFields, value: i32);
1007 #[wasm_bindgen(method, getter = month)]
1008 pub fn get_month(this: &ZonedDateTimeFields) -> Option<u32>;
1009 #[wasm_bindgen(method, setter = month)]
1010 pub fn set_month(this: &ZonedDateTimeFields, value: u32);
1011 #[wasm_bindgen(method, getter = monthCode)]
1012 pub fn get_month_code(this: &ZonedDateTimeFields) -> Option<JsString>;
1013 #[wasm_bindgen(method, setter = monthCode)]
1014 pub fn set_month_code(this: &ZonedDateTimeFields, value: &str);
1015 #[wasm_bindgen(method, getter = day)]
1016 pub fn get_day(this: &ZonedDateTimeFields) -> Option<u32>;
1017 #[wasm_bindgen(method, setter = day)]
1018 pub fn set_day(this: &ZonedDateTimeFields, value: u32);
1019 #[wasm_bindgen(method, getter = hour)]
1020 pub fn get_hour(this: &ZonedDateTimeFields) -> Option<u32>;
1021 #[wasm_bindgen(method, setter = hour)]
1022 pub fn set_hour(this: &ZonedDateTimeFields, value: u32);
1023 #[wasm_bindgen(method, getter = minute)]
1024 pub fn get_minute(this: &ZonedDateTimeFields) -> Option<u32>;
1025 #[wasm_bindgen(method, setter = minute)]
1026 pub fn set_minute(this: &ZonedDateTimeFields, value: u32);
1027 #[wasm_bindgen(method, getter = second)]
1028 pub fn get_second(this: &ZonedDateTimeFields) -> Option<u32>;
1029 #[wasm_bindgen(method, setter = second)]
1030 pub fn set_second(this: &ZonedDateTimeFields, value: u32);
1031 #[wasm_bindgen(method, getter = millisecond)]
1032 pub fn get_millisecond(this: &ZonedDateTimeFields) -> Option<u32>;
1033 #[wasm_bindgen(method, setter = millisecond)]
1034 pub fn set_millisecond(this: &ZonedDateTimeFields, value: u32);
1035 #[wasm_bindgen(method, getter = microsecond)]
1036 pub fn get_microsecond(this: &ZonedDateTimeFields) -> Option<u32>;
1037 #[wasm_bindgen(method, setter = microsecond)]
1038 pub fn set_microsecond(this: &ZonedDateTimeFields, value: u32);
1039 #[wasm_bindgen(method, getter = nanosecond)]
1040 pub fn get_nanosecond(this: &ZonedDateTimeFields) -> Option<u32>;
1041 #[wasm_bindgen(method, setter = nanosecond)]
1042 pub fn set_nanosecond(this: &ZonedDateTimeFields, value: u32);
1043 #[wasm_bindgen(method, getter = offset)]
1044 pub fn get_offset(this: &ZonedDateTimeFields) -> Option<JsString>;
1045 #[wasm_bindgen(method, setter = offset)]
1046 pub fn set_offset(this: &ZonedDateTimeFields, value: &str);
1047}
1048
1049impl ZonedDateTimeFields {
1050 /// Creates an empty `ZonedDateTimeFields`.
1051 pub fn new() -> ZonedDateTimeFields {
1052 JsCast::unchecked_into(Object::new())
1053 }
1054}
1055
1056impl Default for ZonedDateTimeFields {
1057 fn default() -> Self {
1058 Self::new()
1059 }
1060}
1061
1062#[wasm_bindgen]
1063extern "C" {
1064 /// The property bag accepted by `ZonedDateTime.from()`: the `ZonedDateTimeFields`
1065 /// plus `calendar` and `time_zone`. `from()` requires `time_zone`, `year` (or `era`
1066 /// and `era_year`), `month` (or `month_code`) and `day`.
1067 #[wasm_bindgen(extends = ZonedDateTimeFields)]
1068 #[derive(Clone, Debug)]
1069 pub type ZonedDateTimeLike;
1070 /// The `calendar` as set: a string or the Temporal object it was taken from.
1071 #[wasm_bindgen(method, getter = calendar)]
1072 pub fn get_calendar(this: &ZonedDateTimeLike) -> Option<JsValue>;
1073 #[wasm_bindgen(method, setter = calendar)]
1074 pub fn set_calendar(this: &ZonedDateTimeLike, value: &str);
1075 /// Sets `calendar` to the calendar of the given `Temporal.PlainDate`.
1076 #[wasm_bindgen(method, setter = calendar)]
1077 pub fn set_calendar_with_plain_date(this: &ZonedDateTimeLike, value: &PlainDate);
1078 /// Sets `calendar` to the calendar of the given `Temporal.PlainDateTime`.
1079 #[wasm_bindgen(method, setter = calendar)]
1080 pub fn set_calendar_with_plain_date_time(this: &ZonedDateTimeLike, value: &PlainDateTime);
1081 /// Sets `calendar` to the calendar of the given `Temporal.PlainYearMonth`.
1082 #[wasm_bindgen(method, setter = calendar)]
1083 pub fn set_calendar_with_plain_year_month(this: &ZonedDateTimeLike, value: &PlainYearMonth);
1084 /// Sets `calendar` to the calendar of the given `Temporal.PlainMonthDay`.
1085 #[wasm_bindgen(method, setter = calendar)]
1086 pub fn set_calendar_with_plain_month_day(this: &ZonedDateTimeLike, value: &PlainMonthDay);
1087 /// Sets `calendar` to the calendar of the given `Temporal.ZonedDateTime`.
1088 #[wasm_bindgen(method, setter = calendar)]
1089 pub fn set_calendar_with_zoned_date_time(this: &ZonedDateTimeLike, value: &ZonedDateTime);
1090 /// The `timeZone` as set: a string or the `Temporal.ZonedDateTime` it was taken from.
1091 #[wasm_bindgen(method, getter = timeZone)]
1092 pub fn get_time_zone(this: &ZonedDateTimeLike) -> Option<JsValue>;
1093 #[wasm_bindgen(method, setter = timeZone)]
1094 pub fn set_time_zone(this: &ZonedDateTimeLike, value: &str);
1095 /// Sets `timeZone` to the time zone of the given `Temporal.ZonedDateTime`.
1096 #[wasm_bindgen(method, setter = timeZone)]
1097 pub fn set_time_zone_with_zoned_date_time(this: &ZonedDateTimeLike, value: &ZonedDateTime);
1098}
1099
1100impl ZonedDateTimeLike {
1101 /// Creates an empty `ZonedDateTimeLike`.
1102 pub fn new() -> ZonedDateTimeLike {
1103 JsCast::unchecked_into(Object::new())
1104 }
1105}
1106
1107impl Default for ZonedDateTimeLike {
1108 fn default() -> Self {
1109 Self::new()
1110 }
1111}
1112
1113#[wasm_bindgen]
1114extern "C" {
1115 /// The fields accepted by `PlainYearMonth.with()`: `era`/`era_year`, `year` and
1116 /// `month`/`month_code`, each optional.
1117 #[wasm_bindgen(extends = Object)]
1118 #[derive(Clone, Debug)]
1119 pub type PlainYearMonthFields;
1120 #[wasm_bindgen(method, getter = era)]
1121 pub fn get_era(this: &PlainYearMonthFields) -> Option<JsString>;
1122 #[wasm_bindgen(method, setter = era)]
1123 pub fn set_era(this: &PlainYearMonthFields, value: &str);
1124 #[wasm_bindgen(method, getter = eraYear)]
1125 pub fn get_era_year(this: &PlainYearMonthFields) -> Option<i32>;
1126 #[wasm_bindgen(method, setter = eraYear)]
1127 pub fn set_era_year(this: &PlainYearMonthFields, value: i32);
1128 #[wasm_bindgen(method, getter = year)]
1129 pub fn get_year(this: &PlainYearMonthFields) -> Option<i32>;
1130 #[wasm_bindgen(method, setter = year)]
1131 pub fn set_year(this: &PlainYearMonthFields, value: i32);
1132 #[wasm_bindgen(method, getter = month)]
1133 pub fn get_month(this: &PlainYearMonthFields) -> Option<u32>;
1134 #[wasm_bindgen(method, setter = month)]
1135 pub fn set_month(this: &PlainYearMonthFields, value: u32);
1136 #[wasm_bindgen(method, getter = monthCode)]
1137 pub fn get_month_code(this: &PlainYearMonthFields) -> Option<JsString>;
1138 #[wasm_bindgen(method, setter = monthCode)]
1139 pub fn set_month_code(this: &PlainYearMonthFields, value: &str);
1140}
1141
1142impl PlainYearMonthFields {
1143 /// Creates an empty `PlainYearMonthFields`.
1144 pub fn new() -> PlainYearMonthFields {
1145 JsCast::unchecked_into(Object::new())
1146 }
1147}
1148
1149impl Default for PlainYearMonthFields {
1150 fn default() -> Self {
1151 Self::new()
1152 }
1153}
1154
1155#[wasm_bindgen]
1156extern "C" {
1157 /// The property bag accepted by `PlainYearMonth.from()`: the `PlainYearMonthFields`
1158 /// plus `calendar`. `from()` requires `year` (or `era` and `era_year`) and `month`
1159 /// (or `month_code`).
1160 #[wasm_bindgen(extends = PlainYearMonthFields)]
1161 #[derive(Clone, Debug)]
1162 pub type PlainYearMonthLike;
1163 /// The `calendar` as set: a string or the Temporal object it was taken from.
1164 #[wasm_bindgen(method, getter = calendar)]
1165 pub fn get_calendar(this: &PlainYearMonthLike) -> Option<JsValue>;
1166 #[wasm_bindgen(method, setter = calendar)]
1167 pub fn set_calendar(this: &PlainYearMonthLike, value: &str);
1168 /// Sets `calendar` to the calendar of the given `Temporal.PlainDate`.
1169 #[wasm_bindgen(method, setter = calendar)]
1170 pub fn set_calendar_with_plain_date(this: &PlainYearMonthLike, value: &PlainDate);
1171 /// Sets `calendar` to the calendar of the given `Temporal.PlainDateTime`.
1172 #[wasm_bindgen(method, setter = calendar)]
1173 pub fn set_calendar_with_plain_date_time(this: &PlainYearMonthLike, value: &PlainDateTime);
1174 /// Sets `calendar` to the calendar of the given `Temporal.PlainYearMonth`.
1175 #[wasm_bindgen(method, setter = calendar)]
1176 pub fn set_calendar_with_plain_year_month(this: &PlainYearMonthLike, value: &PlainYearMonth);
1177 /// Sets `calendar` to the calendar of the given `Temporal.PlainMonthDay`.
1178 #[wasm_bindgen(method, setter = calendar)]
1179 pub fn set_calendar_with_plain_month_day(this: &PlainYearMonthLike, value: &PlainMonthDay);
1180 /// Sets `calendar` to the calendar of the given `Temporal.ZonedDateTime`.
1181 #[wasm_bindgen(method, setter = calendar)]
1182 pub fn set_calendar_with_zoned_date_time(this: &PlainYearMonthLike, value: &ZonedDateTime);
1183}
1184
1185impl PlainYearMonthLike {
1186 /// Creates an empty `PlainYearMonthLike`.
1187 pub fn new() -> PlainYearMonthLike {
1188 JsCast::unchecked_into(Object::new())
1189 }
1190}
1191
1192impl Default for PlainYearMonthLike {
1193 fn default() -> Self {
1194 Self::new()
1195 }
1196}
1197
1198#[wasm_bindgen]
1199extern "C" {
1200 /// The property bag accepted by `PlainMonthDay.from()`: the `PlainDateFields` plus
1201 /// `calendar`. `from()` requires `day` and either `month_code`, or `month` together
1202 /// with `year` in calendars other than ISO 8601.
1203 #[wasm_bindgen(extends = PlainDateFields)]
1204 #[derive(Clone, Debug)]
1205 pub type PlainMonthDayLike;
1206 /// The `calendar` as set: a string or the Temporal object it was taken from.
1207 #[wasm_bindgen(method, getter = calendar)]
1208 pub fn get_calendar(this: &PlainMonthDayLike) -> Option<JsValue>;
1209 #[wasm_bindgen(method, setter = calendar)]
1210 pub fn set_calendar(this: &PlainMonthDayLike, value: &str);
1211 /// Sets `calendar` to the calendar of the given `Temporal.PlainDate`.
1212 #[wasm_bindgen(method, setter = calendar)]
1213 pub fn set_calendar_with_plain_date(this: &PlainMonthDayLike, value: &PlainDate);
1214 /// Sets `calendar` to the calendar of the given `Temporal.PlainDateTime`.
1215 #[wasm_bindgen(method, setter = calendar)]
1216 pub fn set_calendar_with_plain_date_time(this: &PlainMonthDayLike, value: &PlainDateTime);
1217 /// Sets `calendar` to the calendar of the given `Temporal.PlainYearMonth`.
1218 #[wasm_bindgen(method, setter = calendar)]
1219 pub fn set_calendar_with_plain_year_month(this: &PlainMonthDayLike, value: &PlainYearMonth);
1220 /// Sets `calendar` to the calendar of the given `Temporal.PlainMonthDay`.
1221 #[wasm_bindgen(method, setter = calendar)]
1222 pub fn set_calendar_with_plain_month_day(this: &PlainMonthDayLike, value: &PlainMonthDay);
1223 /// Sets `calendar` to the calendar of the given `Temporal.ZonedDateTime`.
1224 #[wasm_bindgen(method, setter = calendar)]
1225 pub fn set_calendar_with_zoned_date_time(this: &PlainMonthDayLike, value: &ZonedDateTime);
1226}
1227
1228impl PlainMonthDayLike {
1229 /// Creates an empty `PlainMonthDayLike`.
1230 pub fn new() -> PlainMonthDayLike {
1231 JsCast::unchecked_into(Object::new())
1232 }
1233}
1234
1235impl Default for PlainMonthDayLike {
1236 fn default() -> Self {
1237 Self::new()
1238 }
1239}
1240
1241#[wasm_bindgen]
1242extern "C" {
1243 /// The duration fields accepted by `Duration.from()` and `with()`, each optional.
1244 /// At least one of them must be set.
1245 #[wasm_bindgen(extends = Object)]
1246 #[derive(Clone, Debug)]
1247 pub type DurationLike;
1248 #[wasm_bindgen(method, getter = years)]
1249 pub fn get_years(this: &DurationLike) -> Option<f64>;
1250 #[wasm_bindgen(method, setter = years)]
1251 pub fn set_years(this: &DurationLike, value: f64);
1252 #[wasm_bindgen(method, getter = months)]
1253 pub fn get_months(this: &DurationLike) -> Option<f64>;
1254 #[wasm_bindgen(method, setter = months)]
1255 pub fn set_months(this: &DurationLike, value: f64);
1256 #[wasm_bindgen(method, getter = weeks)]
1257 pub fn get_weeks(this: &DurationLike) -> Option<f64>;
1258 #[wasm_bindgen(method, setter = weeks)]
1259 pub fn set_weeks(this: &DurationLike, value: f64);
1260 #[wasm_bindgen(method, getter = days)]
1261 pub fn get_days(this: &DurationLike) -> Option<f64>;
1262 #[wasm_bindgen(method, setter = days)]
1263 pub fn set_days(this: &DurationLike, value: f64);
1264 #[wasm_bindgen(method, getter = hours)]
1265 pub fn get_hours(this: &DurationLike) -> Option<f64>;
1266 #[wasm_bindgen(method, setter = hours)]
1267 pub fn set_hours(this: &DurationLike, value: f64);
1268 #[wasm_bindgen(method, getter = minutes)]
1269 pub fn get_minutes(this: &DurationLike) -> Option<f64>;
1270 #[wasm_bindgen(method, setter = minutes)]
1271 pub fn set_minutes(this: &DurationLike, value: f64);
1272 #[wasm_bindgen(method, getter = seconds)]
1273 pub fn get_seconds(this: &DurationLike) -> Option<f64>;
1274 #[wasm_bindgen(method, setter = seconds)]
1275 pub fn set_seconds(this: &DurationLike, value: f64);
1276 #[wasm_bindgen(method, getter = milliseconds)]
1277 pub fn get_milliseconds(this: &DurationLike) -> Option<f64>;
1278 #[wasm_bindgen(method, setter = milliseconds)]
1279 pub fn set_milliseconds(this: &DurationLike, value: f64);
1280 #[wasm_bindgen(method, getter = microseconds)]
1281 pub fn get_microseconds(this: &DurationLike) -> Option<f64>;
1282 #[wasm_bindgen(method, setter = microseconds)]
1283 pub fn set_microseconds(this: &DurationLike, value: f64);
1284 #[wasm_bindgen(method, getter = nanoseconds)]
1285 pub fn get_nanoseconds(this: &DurationLike) -> Option<f64>;
1286 #[wasm_bindgen(method, setter = nanoseconds)]
1287 pub fn set_nanoseconds(this: &DurationLike, value: f64);
1288}
1289
1290impl DurationLike {
1291 /// Creates an empty `DurationLike`.
1292 pub fn new() -> DurationLike {
1293 JsCast::unchecked_into(Object::new())
1294 }
1295}
1296
1297impl Default for DurationLike {
1298 fn default() -> Self {
1299 Self::new()
1300 }
1301}
1302
1303#[wasm_bindgen]
1304extern "C" {
1305 /// The object form of the `PlainDate.toZonedDateTime()` argument: a time zone
1306 /// and an optional time of day.
1307 #[wasm_bindgen(extends = Object)]
1308 #[derive(Clone, Debug)]
1309 pub type ToZonedDateTimeItem;
1310
1311 /// The `timeZone` as set: a string or the `Temporal.ZonedDateTime` it was taken from.
1312 #[wasm_bindgen(method, getter = timeZone)]
1313 pub fn get_time_zone(this: &ToZonedDateTimeItem) -> Option<JsValue>;
1314 #[wasm_bindgen(method, setter = timeZone)]
1315 pub fn set_time_zone(this: &ToZonedDateTimeItem, value: &str);
1316 /// Sets `timeZone` to the time zone of the given `Temporal.ZonedDateTime`.
1317 #[wasm_bindgen(method, setter = timeZone)]
1318 pub fn set_time_zone_with_zoned_date_time(this: &ToZonedDateTimeItem, value: &ZonedDateTime);
1319 #[wasm_bindgen(method, getter = plainTime)]
1320 pub fn get_plain_time(this: &ToZonedDateTimeItem) -> Option<JsValue>;
1321 #[wasm_bindgen(method, setter = plainTime)]
1322 pub fn set_plain_time(this: &ToZonedDateTimeItem, value: &PlainTime);
1323 #[wasm_bindgen(method, setter = plainTime)]
1324 pub fn set_plain_time_with_str(this: &ToZonedDateTimeItem, value: &str);
1325 #[wasm_bindgen(method, setter = plainTime)]
1326 pub fn set_plain_time_with_plain_time_like(this: &ToZonedDateTimeItem, value: &PlainTimeLike);
1327 #[wasm_bindgen(method, setter = plainTime)]
1328 pub fn set_plain_time_with_plain_date_time(this: &ToZonedDateTimeItem, value: &PlainDateTime);
1329 #[wasm_bindgen(method, setter = plainTime)]
1330 pub fn set_plain_time_with_zoned_date_time(this: &ToZonedDateTimeItem, value: &ZonedDateTime);
1331}
1332
1333impl ToZonedDateTimeItem {
1334 /// Creates a `ToZonedDateTimeItem` for the given time zone.
1335 pub fn new(time_zone: &str) -> ToZonedDateTimeItem {
1336 let item: ToZonedDateTimeItem = JsCast::unchecked_into(Object::new());
1337 item.set_time_zone(time_zone);
1338 item
1339 }
1340
1341 /// Creates a `ToZonedDateTimeItem` for the time zone of the given `Temporal.ZonedDateTime`.
1342 pub fn new_with_zoned_date_time(time_zone: &ZonedDateTime) -> ToZonedDateTimeItem {
1343 let item: ToZonedDateTimeItem = JsCast::unchecked_into(Object::new());
1344 item.set_time_zone_with_zoned_date_time(time_zone);
1345 item
1346 }
1347}
1348
1349// Value equality through the spec-defined `equals()`, which is infallible for
1350// typed arguments. `Duration` has no `equals()`, so it stays identity-only.
1351impl PartialEq for Instant {
1352 fn eq(&self, other: &Self) -> bool {
1353 self.equals(other)
1354 }
1355}
1356
1357impl Eq for Instant {}
1358
1359impl PartialEq for PlainDateTime {
1360 fn eq(&self, other: &Self) -> bool {
1361 self.equals(other)
1362 }
1363}
1364
1365impl Eq for PlainDateTime {}
1366
1367impl PartialEq for ZonedDateTime {
1368 fn eq(&self, other: &Self) -> bool {
1369 self.equals(other)
1370 }
1371}
1372
1373impl Eq for ZonedDateTime {}
1374
1375impl PartialEq for PlainTime {
1376 fn eq(&self, other: &Self) -> bool {
1377 self.equals(other)
1378 }
1379}
1380
1381impl Eq for PlainTime {}
1382
1383impl PartialEq for PlainYearMonth {
1384 fn eq(&self, other: &Self) -> bool {
1385 self.equals(other)
1386 }
1387}
1388
1389impl Eq for PlainYearMonth {}
1390
1391impl PartialEq for PlainMonthDay {
1392 fn eq(&self, other: &Self) -> bool {
1393 self.equals(other)
1394 }
1395}
1396
1397impl Eq for PlainMonthDay {}
1398
1399impl PartialEq for PlainDate {
1400 fn eq(&self, other: &Self) -> bool {
1401 self.equals(other)
1402 }
1403}
1404
1405impl Eq for PlainDate {}
1406
1407// `compare()` orders Instant and PlainTime consistently with `equals()`; the
1408// calendar-bearing types compare their ISO fields only, so `equals()` can be
1409// false where `compare()` is zero and they get no `Ord`.
1410impl PartialOrd for Instant {
1411 fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
1412 Some(self.cmp(other))
1413 }
1414}
1415
1416impl Ord for Instant {
1417 fn cmp(&self, other: &Self) -> core::cmp::Ordering {
1418 Instant::compare(self, other).cmp(&0)
1419 }
1420}
1421
1422impl PartialOrd for PlainTime {
1423 fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
1424 Some(self.cmp(other))
1425 }
1426}
1427
1428impl Ord for PlainTime {
1429 fn cmp(&self, other: &Self) -> core::cmp::Ordering {
1430 PlainTime::compare(self, other).cmp(&0)
1431 }
1432}
1433
1434#[wasm_bindgen]
1435extern "C" {
1436 /// A `Temporal.Instant` is an exact point in time, with a precision in
1437 /// nanoseconds. No time zone or calendar information is present. Therefore,
1438 /// `Temporal.Instant` has no concept of days, months, or even hours.
1439 ///
1440 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant)
1441 #[wasm_bindgen(js_namespace = Temporal, extends = Object)]
1442 #[derive(Clone, Debug)]
1443 pub type Instant;
1444
1445 /// The `Temporal.Instant()` constructor creates `Temporal.Instant` objects.
1446 ///
1447 /// # Errors
1448 /// Throws a `RangeError` if `epoch_nanoseconds` is outside the valid range.
1449 ///
1450 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/Instant)
1451 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1452 pub fn new(epoch_nanoseconds: &BigInt) -> Result<Instant, RangeError>;
1453
1454 /// The `Temporal.Instant.from()` static method creates a new `Temporal.Instant`
1455 /// object from another `Temporal.Instant`, a `Temporal.ZonedDateTime` or an RFC 9557 string.
1456 ///
1457 /// # Errors
1458 /// Throws a `RangeError` if the string is not a valid RFC 9557 format.
1459 ///
1460 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/from)
1461 #[wasm_bindgen(static_method_of = Instant, js_namespace = Temporal, js_name = from, catch)]
1462 pub fn from_with_str(item: &str) -> Result<Instant, RangeError>;
1463
1464 /// The `Temporal.Instant.from()` static method.
1465 #[wasm_bindgen(static_method_of = Instant, js_namespace = Temporal, js_name = from)]
1466 pub fn from_with_instant(item: &Instant) -> Instant;
1467
1468 /// The `Temporal.Instant.from()` static method.
1469 #[wasm_bindgen(static_method_of = Instant, js_namespace = Temporal, js_name = from)]
1470 pub fn from_with_zoned_date_time(item: &ZonedDateTime) -> Instant;
1471
1472 /// The `Temporal.Instant.fromEpochMilliseconds()` static method creates a new
1473 /// `Temporal.Instant` object from the number of milliseconds since the Unix epoch.
1474 ///
1475 /// # Errors
1476 /// Throws a `RangeError` if `epoch_milliseconds` is outside the valid range.
1477 ///
1478 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/fromEpochMilliseconds)
1479 #[wasm_bindgen(static_method_of = Instant, js_namespace = Temporal, js_name = fromEpochMilliseconds, catch)]
1480 pub fn from_epoch_milliseconds(epoch_milliseconds: f64) -> Result<Instant, RangeError>;
1481
1482 /// The `Temporal.Instant.fromEpochNanoseconds()` static method creates a new
1483 /// `Temporal.Instant` object from the number of nanoseconds since the Unix epoch.
1484 ///
1485 /// # Errors
1486 /// Throws a `RangeError` if `epoch_nanoseconds` is outside the valid range.
1487 ///
1488 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/fromEpochNanoseconds)
1489 #[wasm_bindgen(static_method_of = Instant, js_namespace = Temporal, js_name = fromEpochNanoseconds, catch)]
1490 pub fn from_epoch_nanoseconds(epoch_nanoseconds: &BigInt) -> Result<Instant, RangeError>;
1491
1492 /// The `Temporal.Instant.compare()` static method returns -1, 0, or 1 depending
1493 /// on whether `one` comes before, is equal to, or comes after `two`.
1494 ///
1495 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/compare)
1496 #[wasm_bindgen(static_method_of = Instant, js_namespace = Temporal)]
1497 pub fn compare(one: &Instant, two: &Instant) -> i32;
1498
1499 /// The `epochMilliseconds` accessor property returns an integer representing the
1500 /// number of milliseconds since the Unix epoch.
1501 ///
1502 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/epochMilliseconds)
1503 #[wasm_bindgen(method, getter = epochMilliseconds)]
1504 pub fn epoch_milliseconds(this: &Instant) -> f64;
1505
1506 /// The `epochNanoseconds` accessor property returns a BigInt representing the
1507 /// number of nanoseconds since the Unix epoch.
1508 ///
1509 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/epochNanoseconds)
1510 #[wasm_bindgen(method, getter = epochNanoseconds)]
1511 pub fn epoch_nanoseconds(this: &Instant) -> BigInt;
1512
1513 /// The `equals()` method returns `true` if this instant is equivalent to `other`.
1514 ///
1515 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/equals)
1516 #[wasm_bindgen(method)]
1517 pub fn equals(this: &Instant, other: &Instant) -> bool;
1518
1519 /// The `add()` method returns a new `Temporal.Instant` object with the duration
1520 /// added to this instant. The years, months, weeks, and days fields of the
1521 /// duration must be zero.
1522 ///
1523 /// # Errors
1524 /// Throws a `RangeError` if the duration has non-zero calendar units (years, months, weeks, days)
1525 /// or if the result is out of range.
1526 ///
1527 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/add)
1528 #[wasm_bindgen(method, catch)]
1529 pub fn add(this: &Instant, duration: &Duration) -> Result<Instant, RangeError>;
1530
1531 /// The `equals()` method taking a `Temporal.ZonedDateTime`.
1532 #[wasm_bindgen(method, js_name = equals)]
1533 pub fn equals_with_zoned_date_time(this: &Instant, other: &ZonedDateTime) -> bool;
1534
1535 /// The `equals()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
1536 #[wasm_bindgen(method, js_name = equals, catch)]
1537 pub fn equals_with_str(this: &Instant, other: &str) -> Result<bool, RangeError>;
1538
1539 /// The `subtract()` method returns a new `Temporal.Instant` object with the
1540 /// duration subtracted from this instant. The years, months, weeks, and days
1541 /// fields of the duration must be zero.
1542 ///
1543 /// # Errors
1544 /// Throws a `RangeError` if the duration has non-zero calendar units (years, months, weeks, days)
1545 /// or if the result is out of range.
1546 ///
1547 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/subtract)
1548 #[wasm_bindgen(method, catch)]
1549 pub fn subtract(this: &Instant, duration: &Duration) -> Result<Instant, RangeError>;
1550
1551 /// The `add()` method taking a duration property bag.
1552 ///
1553 /// # Errors
1554 /// Throws a `TypeError` if no duration field is set; see [`Instant::add`] for the remaining errors.
1555 #[wasm_bindgen(method, js_name = add, catch)]
1556 pub fn add_with_duration_like(
1557 this: &Instant,
1558 duration: &DurationLike,
1559 ) -> Result<Instant, Error>;
1560
1561 /// The `subtract()` method taking a duration property bag.
1562 ///
1563 /// # Errors
1564 /// Throws a `TypeError` if no duration field is set; see [`Instant::subtract`] for the remaining errors.
1565 #[wasm_bindgen(method, js_name = subtract, catch)]
1566 pub fn subtract_with_duration_like(
1567 this: &Instant,
1568 duration: &DurationLike,
1569 ) -> Result<Instant, Error>;
1570
1571 /// The `subtract()` method taking an ISO 8601 duration string.
1572 ///
1573 /// # Errors
1574 /// Throws a `RangeError` if the string is not a valid duration; see [`Instant::subtract`] for the remaining errors.
1575 #[wasm_bindgen(method, js_name = subtract, catch)]
1576 pub fn subtract_with_str(this: &Instant, duration: &str) -> Result<Instant, RangeError>;
1577
1578 /// The `add()` method taking an ISO 8601 duration string.
1579 ///
1580 /// # Errors
1581 /// Throws a `RangeError` if the string is not a valid duration; see [`Instant::add`] for the remaining errors.
1582 #[wasm_bindgen(method, js_name = add, catch)]
1583 pub fn add_with_str(this: &Instant, duration: &str) -> Result<Instant, RangeError>;
1584
1585 /// The `until()` method returns a `Temporal.Duration` representing the duration
1586 /// from this instant until `other`.
1587 ///
1588 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/until)
1589 #[wasm_bindgen(method)]
1590 pub fn until(this: &Instant, other: &Instant) -> Duration;
1591
1592 /// The `until()` method returns a `Temporal.Duration` representing the duration
1593 /// from this instant until `other`.
1594 ///
1595 /// # Errors
1596 /// Throws a `RangeError` if options specify invalid units (days and calendar units are not allowed).
1597 ///
1598 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/until)
1599 #[wasm_bindgen(method, js_name = until, catch)]
1600 pub fn until_with_options(
1601 this: &Instant,
1602 other: &Instant,
1603 options: &DifferenceOptions,
1604 ) -> Result<Duration, RangeError>;
1605
1606 /// The `since()` method returns a `Temporal.Duration` representing the duration
1607 /// from `other` until this instant.
1608 ///
1609 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/since)
1610 #[wasm_bindgen(method)]
1611 pub fn since(this: &Instant, other: &Instant) -> Duration;
1612
1613 /// The `until()` method taking a `Temporal.ZonedDateTime`.
1614 #[wasm_bindgen(method, js_name = until)]
1615 pub fn until_with_zoned_date_time(this: &Instant, other: &ZonedDateTime) -> Duration;
1616
1617 /// The `until()` method taking a `Temporal.ZonedDateTime` and options; see [`Instant::until_with_options`]
1618 /// for errors.
1619 #[wasm_bindgen(method, js_name = until, catch)]
1620 pub fn until_with_zoned_date_time_and_options(
1621 this: &Instant,
1622 other: &ZonedDateTime,
1623 options: &DifferenceOptions,
1624 ) -> Result<Duration, RangeError>;
1625
1626 /// The `until()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
1627 #[wasm_bindgen(method, js_name = until, catch)]
1628 pub fn until_with_str(this: &Instant, other: &str) -> Result<Duration, RangeError>;
1629
1630 /// The `until()` method taking an ISO 8601 string and options; see [`Instant::until_with_options`]
1631 /// for errors.
1632 #[wasm_bindgen(method, js_name = until, catch)]
1633 pub fn until_with_str_and_options(
1634 this: &Instant,
1635 other: &str,
1636 options: &DifferenceOptions,
1637 ) -> Result<Duration, RangeError>;
1638
1639 /// The `since()` method returns a `Temporal.Duration` representing the duration
1640 /// from `other` until this instant.
1641 ///
1642 /// # Errors
1643 /// Throws a `RangeError` if options specify invalid units (days and calendar units are not allowed).
1644 ///
1645 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/since)
1646 #[wasm_bindgen(method, js_name = since, catch)]
1647 pub fn since_with_options(
1648 this: &Instant,
1649 other: &Instant,
1650 options: &DifferenceOptions,
1651 ) -> Result<Duration, RangeError>;
1652
1653 /// The `round()` method returns a new `Temporal.Instant` object with the instant
1654 /// rounded to the given unit.
1655 ///
1656 /// # Errors
1657 /// Throws a `RangeError` if `smallestUnit` is not provided, specifies calendar units,
1658 /// or if `roundingIncrement` is invalid for the unit.
1659 ///
1660 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/round)
1661 #[wasm_bindgen(method, js_name = round, catch)]
1662 pub fn round(this: &Instant, round_to: &RoundToOptions) -> Result<Instant, RangeError>;
1663
1664 /// The `since()` method taking a `Temporal.ZonedDateTime`.
1665 #[wasm_bindgen(method, js_name = since)]
1666 pub fn since_with_zoned_date_time(this: &Instant, other: &ZonedDateTime) -> Duration;
1667
1668 /// The `since()` method taking a `Temporal.ZonedDateTime` and options; see [`Instant::since_with_options`]
1669 /// for errors.
1670 #[wasm_bindgen(method, js_name = since, catch)]
1671 pub fn since_with_zoned_date_time_and_options(
1672 this: &Instant,
1673 other: &ZonedDateTime,
1674 options: &DifferenceOptions,
1675 ) -> Result<Duration, RangeError>;
1676
1677 /// The `since()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
1678 #[wasm_bindgen(method, js_name = since, catch)]
1679 pub fn since_with_str(this: &Instant, other: &str) -> Result<Duration, RangeError>;
1680
1681 /// The `since()` method taking an ISO 8601 string and options; see [`Instant::since_with_options`]
1682 /// for errors.
1683 #[wasm_bindgen(method, js_name = since, catch)]
1684 pub fn since_with_str_and_options(
1685 this: &Instant,
1686 other: &str,
1687 options: &DifferenceOptions,
1688 ) -> Result<Duration, RangeError>;
1689
1690 /// Shorthand for `round()` with only `smallestUnit` set.
1691 #[wasm_bindgen(method, js_name = round, catch)]
1692 pub fn round_with_unit(this: &Instant, smallest_unit: Unit) -> Result<Instant, RangeError>;
1693
1694 /// The `toZonedDateTimeISO()` method returns a `Temporal.ZonedDateTime`
1695 /// representing this instant in the ISO 8601 calendar and the given time zone.
1696 ///
1697 /// # Errors
1698 /// Throws a `RangeError` if `time_zone` is not a valid time zone identifier.
1699 ///
1700 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/toZonedDateTimeISO)
1701 #[wasm_bindgen(method, js_name = toZonedDateTimeISO, catch)]
1702 pub fn to_zoned_date_time_iso(
1703 this: &Instant,
1704 time_zone: &str,
1705 ) -> Result<ZonedDateTime, RangeError>;
1706
1707 /// The `toZonedDateTimeISO()` method in the time zone of the given `Temporal.ZonedDateTime`.
1708 #[wasm_bindgen(method, js_name = toZonedDateTimeISO)]
1709 pub fn to_zoned_date_time_iso_with_zoned_date_time(
1710 this: &Instant,
1711 time_zone: &ZonedDateTime,
1712 ) -> ZonedDateTime;
1713
1714 /// The `toLocaleString()` method returns a language-sensitive string representation
1715 /// of this instant.
1716 ///
1717 /// # Errors
1718 /// Throws a `RangeError` if `locales` is invalid.
1719 ///
1720 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/toLocaleString)
1721 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
1722 pub fn to_locale_string(this: &Instant) -> Result<JsString, RangeError>;
1723
1724 /// The `toLocaleString()` method; see [`Instant::to_locale_string`] for errors.
1725 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
1726 pub fn to_locale_string_with_str(this: &Instant, locales: &str)
1727 -> Result<JsString, RangeError>;
1728
1729 /// The `toLocaleString()` method; see [`Instant::to_locale_string`] for errors.
1730 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
1731 pub fn to_locale_string_with_str_sequence(
1732 this: &Instant,
1733 locales: &[JsString],
1734 ) -> Result<JsString, RangeError>;
1735
1736 /// The `toLocaleString()` method with options; throws a `TypeError` if an option does not
1737 /// apply to this type or conflicts with another. See [`Instant::to_locale_string`] for the
1738 /// remaining errors.
1739 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
1740 pub fn to_locale_string_with_str_sequence_and_options(
1741 this: &Instant,
1742 locales: &[JsString],
1743 options: &Intl::DateTimeFormatOptions,
1744 ) -> Result<JsString, Error>;
1745
1746 /// The `toLocaleString()` method with options; `None` for `locales` uses the default locale.
1747 /// Throws a `TypeError` if an option does not apply to this type or conflicts with another.
1748 /// See [`Instant::to_locale_string`] for the remaining errors.
1749 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
1750 pub fn to_locale_string_with_options(
1751 this: &Instant,
1752 locales: Option<&str>,
1753 options: &Intl::DateTimeFormatOptions,
1754 ) -> Result<JsString, Error>;
1755
1756 /// The `toJSON()` method returns a string representation of this instant suitable
1757 /// for JSON serialization.
1758 ///
1759 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/toJSON)
1760 #[wasm_bindgen(method, js_name = toJSON)]
1761 pub fn to_json(this: &Instant) -> JsString;
1762
1763 /// The `toString()` method returns an RFC 9557 string representation of this instant.
1764 ///
1765 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/toString)
1766 #[wasm_bindgen(method, js_name = toString)]
1767 pub fn to_js_string(this: &Instant) -> JsString;
1768
1769 /// The `toString()` method returns an RFC 9557 string representation of this instant,
1770 /// formatted according to `options`.
1771 ///
1772 /// # Errors
1773 /// Throws a `RangeError` if the options are invalid for this type.
1774 ///
1775 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/toString)
1776 #[wasm_bindgen(method, js_name = toString, catch)]
1777 pub fn to_js_string_with_options(
1778 this: &Instant,
1779 options: &InstantToStringOptions,
1780 ) -> Result<JsString, RangeError>;
1781}
1782
1783#[wasm_bindgen]
1784extern "C" {
1785 /// A `Temporal.PlainDateTime` represents a calendar date and wall-clock time, with
1786 /// a precision in nanoseconds, and without any time zone.
1787 ///
1788 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime)
1789 #[wasm_bindgen(js_namespace = Temporal, extends = Object)]
1790 #[derive(Clone, Debug)]
1791 pub type PlainDateTime;
1792
1793 /// The `Temporal.PlainDateTime()` constructor creates `Temporal.PlainDateTime` objects.
1794 /// Omitted fields default to zero, or to the ISO 8601 calendar.
1795 ///
1796 /// # Errors
1797 /// Throws a `RangeError` if any field is out of range or `calendar` is not a
1798 /// supported calendar identifier.
1799 ///
1800 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/PlainDateTime)
1801 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1802 pub fn new(iso_year: i32, iso_month: u32, iso_day: u32) -> Result<PlainDateTime, RangeError>;
1803
1804 /// The `Temporal.PlainDateTime()` constructor; see [`PlainDateTime::new`] for errors.
1805 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1806 pub fn new_with_hour(
1807 iso_year: i32,
1808 iso_month: u32,
1809 iso_day: u32,
1810 hour: u32,
1811 ) -> Result<PlainDateTime, RangeError>;
1812
1813 /// The `Temporal.PlainDateTime()` constructor; see [`PlainDateTime::new`] for errors.
1814 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1815 pub fn new_with_hour_and_minute(
1816 iso_year: i32,
1817 iso_month: u32,
1818 iso_day: u32,
1819 hour: u32,
1820 minute: u32,
1821 ) -> Result<PlainDateTime, RangeError>;
1822
1823 /// The `Temporal.PlainDateTime()` constructor; see [`PlainDateTime::new`] for errors.
1824 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1825 pub fn new_with_hour_and_minute_and_second(
1826 iso_year: i32,
1827 iso_month: u32,
1828 iso_day: u32,
1829 hour: u32,
1830 minute: u32,
1831 second: u32,
1832 ) -> Result<PlainDateTime, RangeError>;
1833
1834 /// The `Temporal.PlainDateTime()` constructor; see [`PlainDateTime::new`] for errors.
1835 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1836 pub fn new_with_hour_and_minute_and_second_and_millisecond(
1837 iso_year: i32,
1838 iso_month: u32,
1839 iso_day: u32,
1840 hour: u32,
1841 minute: u32,
1842 second: u32,
1843 millisecond: u32,
1844 ) -> Result<PlainDateTime, RangeError>;
1845
1846 /// The `Temporal.PlainDateTime()` constructor; see [`PlainDateTime::new`] for errors.
1847 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1848 pub fn new_with_hour_and_minute_and_second_and_millisecond_and_microsecond(
1849 iso_year: i32,
1850 iso_month: u32,
1851 iso_day: u32,
1852 hour: u32,
1853 minute: u32,
1854 second: u32,
1855 millisecond: u32,
1856 microsecond: u32,
1857 ) -> Result<PlainDateTime, RangeError>;
1858
1859 /// The `Temporal.PlainDateTime()` constructor; see [`PlainDateTime::new`] for errors.
1860 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1861 pub fn new_with_hour_and_minute_and_second_and_millisecond_and_microsecond_and_nanosecond(
1862 iso_year: i32,
1863 iso_month: u32,
1864 iso_day: u32,
1865 hour: u32,
1866 minute: u32,
1867 second: u32,
1868 millisecond: u32,
1869 microsecond: u32,
1870 nanosecond: u32,
1871 ) -> Result<PlainDateTime, RangeError>;
1872
1873 /// The `Temporal.PlainDateTime()` constructor; see [`PlainDateTime::new`] for errors.
1874 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
1875 pub fn new_with_hour_and_minute_and_second_and_millisecond_and_microsecond_and_nanosecond_and_calendar(
1876 iso_year: i32,
1877 iso_month: u32,
1878 iso_day: u32,
1879 hour: u32,
1880 minute: u32,
1881 second: u32,
1882 millisecond: u32,
1883 microsecond: u32,
1884 nanosecond: u32,
1885 calendar: &str,
1886 ) -> Result<PlainDateTime, RangeError>;
1887
1888 /// The `Temporal.PlainDateTime.from()` static method creates a new `Temporal.PlainDateTime`
1889 /// object from another value.
1890 ///
1891 /// # Errors
1892 /// Throws a `RangeError` if the string is invalid or values are out of range
1893 /// (when `overflow` is `'reject'`).
1894 ///
1895 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/from)
1896 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from, catch)]
1897 pub fn from_with_str(item: &str) -> Result<PlainDateTime, RangeError>;
1898
1899 /// The `Temporal.PlainDateTime.from()` static method; see [`PlainDateTime::from_with_str`] for errors.
1900 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from, catch)]
1901 pub fn from_with_str_and_options(
1902 item: &str,
1903 options: &OverflowOptions,
1904 ) -> Result<PlainDateTime, RangeError>;
1905
1906 /// The `Temporal.PlainDateTime.from()` static method taking a property bag; throws a `TypeError` if
1907 /// required fields are missing. See [`PlainDateTime::from_with_str`] for the remaining errors.
1908 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from, catch)]
1909 pub fn from_with_plain_date_time_like(item: &PlainDateTimeLike)
1910 -> Result<PlainDateTime, Error>;
1911
1912 /// The `Temporal.PlainDateTime.from()` static method taking a property bag; throws a `TypeError` if
1913 /// required fields are missing. See [`PlainDateTime::from_with_str`] for the remaining errors.
1914 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from, catch)]
1915 pub fn from_with_plain_date_time_like_and_options(
1916 item: &PlainDateTimeLike,
1917 options: &OverflowOptions,
1918 ) -> Result<PlainDateTime, Error>;
1919
1920 /// The `Temporal.PlainDateTime.from()` static method.
1921 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from)]
1922 pub fn from_with_plain_date_time(item: &PlainDateTime) -> PlainDateTime;
1923
1924 /// The `Temporal.PlainDateTime.from()` static method.
1925 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from)]
1926 pub fn from_with_plain_date_time_and_options(
1927 item: &PlainDateTime,
1928 options: &OverflowOptions,
1929 ) -> PlainDateTime;
1930
1931 /// The `Temporal.PlainDateTime.from()` static method.
1932 ///
1933 /// # Errors
1934 /// Throws a `RangeError` if midnight on the date falls outside the representable range.
1935 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from, catch)]
1936 pub fn from_with_plain_date(item: &PlainDate) -> Result<PlainDateTime, RangeError>;
1937
1938 /// The `Temporal.PlainDateTime.from()` static method; see [`PlainDateTime::from_with_plain_date`] for errors.
1939 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from, catch)]
1940 pub fn from_with_plain_date_and_options(
1941 item: &PlainDate,
1942 options: &OverflowOptions,
1943 ) -> Result<PlainDateTime, RangeError>;
1944
1945 /// The `Temporal.PlainDateTime.from()` static method.
1946 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from)]
1947 pub fn from_with_zoned_date_time(item: &ZonedDateTime) -> PlainDateTime;
1948
1949 /// The `Temporal.PlainDateTime.from()` static method.
1950 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal, js_name = from)]
1951 pub fn from_with_zoned_date_time_and_options(
1952 item: &ZonedDateTime,
1953 options: &OverflowOptions,
1954 ) -> PlainDateTime;
1955
1956 /// The `Temporal.PlainDateTime.compare()` static method returns -1, 0, or 1 depending
1957 /// on whether `one` comes before, is equal to, or comes after `two`.
1958 ///
1959 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/compare)
1960 #[wasm_bindgen(static_method_of = PlainDateTime, js_namespace = Temporal)]
1961 pub fn compare(one: &PlainDateTime, two: &PlainDateTime) -> i32;
1962
1963 /// The `era` accessor property returns a calendar-specific lowercase string
1964 /// representing the era of this date, or `None` if the calendar does not use eras.
1965 ///
1966 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/era)
1967 #[wasm_bindgen(method, getter)]
1968 pub fn era(this: &PlainDateTime) -> Option<JsString>;
1969
1970 /// The `eraYear` accessor property returns a non-negative integer representing the
1971 /// year of this date within the era, or `None` if the calendar does not use eras.
1972 ///
1973 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/eraYear)
1974 #[wasm_bindgen(method, getter = eraYear)]
1975 pub fn era_year(this: &PlainDateTime) -> Option<i32>;
1976
1977 /// The `year` accessor property returns an integer representing the number of years
1978 /// of this date relative to the start of a calendar-specific epoch year.
1979 ///
1980 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/year)
1981 #[wasm_bindgen(method, getter)]
1982 pub fn year(this: &PlainDateTime) -> i32;
1983
1984 /// The `month` accessor property returns a positive integer representing the
1985 /// 1-based month index in the year of this date.
1986 ///
1987 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/month)
1988 #[wasm_bindgen(method, getter)]
1989 pub fn month(this: &PlainDateTime) -> u32;
1990
1991 /// The `monthCode` accessor property returns a calendar-specific string representing
1992 /// the month of this date.
1993 ///
1994 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/monthCode)
1995 #[wasm_bindgen(method, getter = monthCode)]
1996 pub fn month_code(this: &PlainDateTime) -> JsString;
1997
1998 /// The `day` accessor property returns a positive integer representing the
1999 /// 1-based day index in the month of this date.
2000 ///
2001 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/day)
2002 #[wasm_bindgen(method, getter)]
2003 pub fn day(this: &PlainDateTime) -> u32;
2004
2005 /// The `hour` accessor property returns an integer from 0 to 23 representing
2006 /// the hour component of this time.
2007 ///
2008 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/hour)
2009 #[wasm_bindgen(method, getter)]
2010 pub fn hour(this: &PlainDateTime) -> u32;
2011
2012 /// The `minute` accessor property returns an integer from 0 to 59 representing
2013 /// the minute component of this time.
2014 ///
2015 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/minute)
2016 #[wasm_bindgen(method, getter)]
2017 pub fn minute(this: &PlainDateTime) -> u32;
2018
2019 /// The `second` accessor property returns an integer from 0 to 59 representing
2020 /// the second component of this time.
2021 ///
2022 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/second)
2023 #[wasm_bindgen(method, getter)]
2024 pub fn second(this: &PlainDateTime) -> u32;
2025
2026 /// The `millisecond` accessor property returns an integer from 0 to 999 representing
2027 /// the millisecond component of this time.
2028 ///
2029 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/millisecond)
2030 #[wasm_bindgen(method, getter)]
2031 pub fn millisecond(this: &PlainDateTime) -> u32;
2032
2033 /// The `microsecond` accessor property returns an integer from 0 to 999 representing
2034 /// the microsecond component of this time.
2035 ///
2036 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/microsecond)
2037 #[wasm_bindgen(method, getter)]
2038 pub fn microsecond(this: &PlainDateTime) -> u32;
2039
2040 /// The `nanosecond` accessor property returns an integer from 0 to 999 representing
2041 /// the nanosecond component of this time.
2042 ///
2043 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/nanosecond)
2044 #[wasm_bindgen(method, getter)]
2045 pub fn nanosecond(this: &PlainDateTime) -> u32;
2046
2047 /// The `calendarId` accessor property returns a string representing the calendar
2048 /// used to interpret the internal ISO 8601 date.
2049 ///
2050 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/calendarId)
2051 #[wasm_bindgen(method, getter = calendarId)]
2052 pub fn calendar_id(this: &PlainDateTime) -> JsString;
2053
2054 /// The `dayOfWeek` accessor property returns a positive integer representing the
2055 /// day of the week of this date (1 = Monday through 7 = Sunday for ISO 8601).
2056 ///
2057 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/dayOfWeek)
2058 #[wasm_bindgen(method, getter = dayOfWeek)]
2059 pub fn day_of_week(this: &PlainDateTime) -> u32;
2060
2061 /// The `dayOfYear` accessor property returns a positive integer representing the
2062 /// 1-based day index of this date in the year.
2063 ///
2064 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/dayOfYear)
2065 #[wasm_bindgen(method, getter = dayOfYear)]
2066 pub fn day_of_year(this: &PlainDateTime) -> u32;
2067
2068 /// The `weekOfYear` accessor property returns a positive integer representing the
2069 /// 1-based week index in the `yearOfWeek` of this date, or `None` if the
2070 /// calendar does not have a well-defined week system.
2071 ///
2072 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/weekOfYear)
2073 #[wasm_bindgen(method, getter = weekOfYear)]
2074 pub fn week_of_year(this: &PlainDateTime) -> Option<u32>;
2075
2076 /// The `yearOfWeek` accessor property returns an integer representing the year
2077 /// to be paired with `weekOfYear`, or `None` if the calendar does not have
2078 /// a well-defined week system.
2079 ///
2080 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/yearOfWeek)
2081 #[wasm_bindgen(method, getter = yearOfWeek)]
2082 pub fn year_of_week(this: &PlainDateTime) -> Option<i32>;
2083
2084 /// The `daysInWeek` accessor property returns a positive integer representing the
2085 /// number of days in the week of this date.
2086 ///
2087 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/daysInWeek)
2088 #[wasm_bindgen(method, getter = daysInWeek)]
2089 pub fn days_in_week(this: &PlainDateTime) -> u32;
2090
2091 /// The `daysInMonth` accessor property returns a positive integer representing the
2092 /// number of days in the month of this date.
2093 ///
2094 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/daysInMonth)
2095 #[wasm_bindgen(method, getter = daysInMonth)]
2096 pub fn days_in_month(this: &PlainDateTime) -> u32;
2097
2098 /// The `daysInYear` accessor property returns a positive integer representing the
2099 /// number of days in the year of this date.
2100 ///
2101 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/daysInYear)
2102 #[wasm_bindgen(method, getter = daysInYear)]
2103 pub fn days_in_year(this: &PlainDateTime) -> u32;
2104
2105 /// The `monthsInYear` accessor property returns a positive integer representing the
2106 /// number of months in the year of this date.
2107 ///
2108 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/monthsInYear)
2109 #[wasm_bindgen(method, getter = monthsInYear)]
2110 pub fn months_in_year(this: &PlainDateTime) -> u32;
2111
2112 /// The `inLeapYear` accessor property returns `true` if this date is in a leap year,
2113 /// and `false` otherwise.
2114 ///
2115 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/inLeapYear)
2116 #[wasm_bindgen(method, getter = inLeapYear)]
2117 pub fn in_leap_year(this: &PlainDateTime) -> bool;
2118
2119 /// The `equals()` method returns `true` if this date-time is equivalent to `other`.
2120 ///
2121 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/equals)
2122 #[wasm_bindgen(method)]
2123 pub fn equals(this: &PlainDateTime, other: &PlainDateTime) -> bool;
2124
2125 /// The `with()` method returns a new `Temporal.PlainDateTime` object with some
2126 /// fields replaced by new values.
2127 ///
2128 /// # Errors
2129 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
2130 /// of range or `overflow` is `'reject'` and a field would need constraining.
2131 ///
2132 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/with)
2133 #[wasm_bindgen(method, catch)]
2134 pub fn with(this: &PlainDateTime, fields: &PlainDateTimeFields)
2135 -> Result<PlainDateTime, Error>;
2136
2137 /// The `equals()` method taking a `Temporal.PlainDate`; throws a `RangeError` if midnight on
2138 /// the date falls outside the representable range.
2139 #[wasm_bindgen(method, js_name = equals, catch)]
2140 pub fn equals_with_plain_date(
2141 this: &PlainDateTime,
2142 other: &PlainDate,
2143 ) -> Result<bool, RangeError>;
2144
2145 /// The `equals()` method taking a `Temporal.ZonedDateTime`.
2146 #[wasm_bindgen(method, js_name = equals)]
2147 pub fn equals_with_zoned_date_time(this: &PlainDateTime, other: &ZonedDateTime) -> bool;
2148
2149 /// The `equals()` method taking a property bag; throws a `TypeError` if required fields are missing.
2150 #[wasm_bindgen(method, js_name = equals, catch)]
2151 pub fn equals_with_plain_date_time_like(
2152 this: &PlainDateTime,
2153 other: &PlainDateTimeLike,
2154 ) -> Result<bool, Error>;
2155
2156 /// The `equals()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
2157 #[wasm_bindgen(method, js_name = equals, catch)]
2158 pub fn equals_with_str(this: &PlainDateTime, other: &str) -> Result<bool, RangeError>;
2159
2160 /// The `with()` method returns a new `Temporal.PlainDateTime` object with some
2161 /// fields replaced by new values.
2162 ///
2163 /// # Errors
2164 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
2165 /// of range or `overflow` is `'reject'` and a field would need constraining.
2166 ///
2167 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/with)
2168 #[wasm_bindgen(method, js_name = with, catch)]
2169 pub fn with_with_options(
2170 this: &PlainDateTime,
2171 fields: &PlainDateTimeFields,
2172 options: &OverflowOptions,
2173 ) -> Result<PlainDateTime, Error>;
2174
2175 /// The `withPlainTime()` method returns a new `Temporal.PlainDateTime` object with
2176 /// the time part replaced by the given time (or midnight if not provided).
2177 ///
2178 /// # Errors
2179 /// Throws a `RangeError` if the result falls outside the representable range.
2180 ///
2181 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/withPlainTime)
2182 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
2183 pub fn with_plain_time(this: &PlainDateTime) -> Result<PlainDateTime, RangeError>;
2184
2185 /// The `withPlainTime()` method returns a new `Temporal.PlainDateTime` object with
2186 /// the time part replaced by the given time (or midnight if not provided).
2187 ///
2188 /// # Errors
2189 /// Throws a `RangeError` if the result falls outside the representable range.
2190 ///
2191 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/withPlainTime)
2192 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
2193 pub fn with_plain_time_with_plain_time(
2194 this: &PlainDateTime,
2195 plain_time: &PlainTime,
2196 ) -> Result<PlainDateTime, RangeError>;
2197
2198 /// The `withCalendar()` method returns a new `Temporal.PlainDateTime` object with
2199 /// the calendar replaced.
2200 ///
2201 /// # Errors
2202 /// Throws a `RangeError` if the calendar identifier is invalid.
2203 ///
2204 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/withCalendar)
2205 #[wasm_bindgen(method, js_name = withCalendar, catch)]
2206 pub fn with_calendar(this: &PlainDateTime, calendar: &str)
2207 -> Result<PlainDateTime, RangeError>;
2208
2209 /// The `withPlainTime()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`PlainDateTime::with_plain_time`] for the remaining errors.
2210 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
2211 pub fn with_plain_time_with_str(
2212 this: &PlainDateTime,
2213 plain_time: &str,
2214 ) -> Result<PlainDateTime, RangeError>;
2215
2216 /// The `withPlainTime()` method taking a property bag; throws a `TypeError` if no time field is present; see [`PlainDateTime::with_plain_time`] for the remaining errors.
2217 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
2218 pub fn with_plain_time_with_plain_time_like(
2219 this: &PlainDateTime,
2220 plain_time: &PlainTimeLike,
2221 ) -> Result<PlainDateTime, Error>;
2222
2223 /// The `withPlainTime()` method taking a `Temporal.PlainDateTime`; see [`PlainDateTime::with_plain_time`] for errors.
2224 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
2225 pub fn with_plain_time_with_plain_date_time(
2226 this: &PlainDateTime,
2227 plain_time: &PlainDateTime,
2228 ) -> Result<PlainDateTime, RangeError>;
2229
2230 /// The `withPlainTime()` method taking a `Temporal.ZonedDateTime`; see [`PlainDateTime::with_plain_time`] for errors.
2231 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
2232 pub fn with_plain_time_with_zoned_date_time(
2233 this: &PlainDateTime,
2234 plain_time: &ZonedDateTime,
2235 ) -> Result<PlainDateTime, RangeError>;
2236
2237 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainDate`.
2238 #[wasm_bindgen(method, js_name = withCalendar)]
2239 pub fn with_calendar_with_plain_date(
2240 this: &PlainDateTime,
2241 calendar: &PlainDate,
2242 ) -> PlainDateTime;
2243
2244 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainDateTime`.
2245 #[wasm_bindgen(method, js_name = withCalendar)]
2246 pub fn with_calendar_with_plain_date_time(
2247 this: &PlainDateTime,
2248 calendar: &PlainDateTime,
2249 ) -> PlainDateTime;
2250
2251 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainYearMonth`.
2252 #[wasm_bindgen(method, js_name = withCalendar)]
2253 pub fn with_calendar_with_plain_year_month(
2254 this: &PlainDateTime,
2255 calendar: &PlainYearMonth,
2256 ) -> PlainDateTime;
2257
2258 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainMonthDay`.
2259 #[wasm_bindgen(method, js_name = withCalendar)]
2260 pub fn with_calendar_with_plain_month_day(
2261 this: &PlainDateTime,
2262 calendar: &PlainMonthDay,
2263 ) -> PlainDateTime;
2264
2265 /// The `withCalendar()` method taking the calendar of the given `Temporal.ZonedDateTime`.
2266 #[wasm_bindgen(method, js_name = withCalendar)]
2267 pub fn with_calendar_with_zoned_date_time(
2268 this: &PlainDateTime,
2269 calendar: &ZonedDateTime,
2270 ) -> PlainDateTime;
2271
2272 /// The `add()` method returns a new `Temporal.PlainDateTime` object with the
2273 /// duration added to this date-time.
2274 ///
2275 /// # Errors
2276 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
2277 /// field would need constraining.
2278 ///
2279 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/add)
2280 #[wasm_bindgen(method, catch)]
2281 pub fn add(this: &PlainDateTime, duration: &Duration) -> Result<PlainDateTime, RangeError>;
2282
2283 /// The `add()` method returns a new `Temporal.PlainDateTime` object with the
2284 /// duration added to this date-time.
2285 ///
2286 /// # Errors
2287 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
2288 /// field would need constraining.
2289 ///
2290 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/add)
2291 #[wasm_bindgen(method, js_name = add, catch)]
2292 pub fn add_with_options(
2293 this: &PlainDateTime,
2294 duration: &Duration,
2295 options: &OverflowOptions,
2296 ) -> Result<PlainDateTime, RangeError>;
2297
2298 /// The `add()` method taking a duration property bag.
2299 ///
2300 /// # Errors
2301 /// Throws a `TypeError` if no duration field is set; see [`PlainDateTime::add`] for the remaining errors.
2302 #[wasm_bindgen(method, js_name = add, catch)]
2303 pub fn add_with_duration_like(
2304 this: &PlainDateTime,
2305 duration: &DurationLike,
2306 ) -> Result<PlainDateTime, Error>;
2307
2308 /// The `add()` method taking a duration property bag and options; see
2309 /// [`PlainDateTime::add_with_duration_like`] for errors.
2310 #[wasm_bindgen(method, js_name = add, catch)]
2311 pub fn add_with_duration_like_and_options(
2312 this: &PlainDateTime,
2313 duration: &DurationLike,
2314 options: &OverflowOptions,
2315 ) -> Result<PlainDateTime, Error>;
2316
2317 /// The `add()` method taking an ISO 8601 duration string and options; see
2318 /// [`PlainDateTime::add_with_str`] for errors.
2319 #[wasm_bindgen(method, js_name = add, catch)]
2320 pub fn add_with_str_and_options(
2321 this: &PlainDateTime,
2322 duration: &str,
2323 options: &OverflowOptions,
2324 ) -> Result<PlainDateTime, RangeError>;
2325
2326 /// The `add()` method taking an ISO 8601 duration string.
2327 ///
2328 /// # Errors
2329 /// Throws a `RangeError` if the string is not a valid duration; see [`PlainDateTime::add`] for the remaining errors.
2330 #[wasm_bindgen(method, js_name = add, catch)]
2331 pub fn add_with_str(this: &PlainDateTime, duration: &str) -> Result<PlainDateTime, RangeError>;
2332
2333 /// The `subtract()` method returns a new `Temporal.PlainDateTime` object with the
2334 /// duration subtracted from this date-time.
2335 ///
2336 /// # Errors
2337 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
2338 /// field would need constraining.
2339 ///
2340 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/subtract)
2341 #[wasm_bindgen(method, catch)]
2342 pub fn subtract(this: &PlainDateTime, duration: &Duration)
2343 -> Result<PlainDateTime, RangeError>;
2344
2345 /// The `subtract()` method returns a new `Temporal.PlainDateTime` object with the
2346 /// duration subtracted from this date-time.
2347 ///
2348 /// # Errors
2349 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
2350 /// field would need constraining.
2351 ///
2352 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/subtract)
2353 #[wasm_bindgen(method, js_name = subtract, catch)]
2354 pub fn subtract_with_options(
2355 this: &PlainDateTime,
2356 duration: &Duration,
2357 options: &OverflowOptions,
2358 ) -> Result<PlainDateTime, RangeError>;
2359
2360 /// The `subtract()` method taking a duration property bag.
2361 ///
2362 /// # Errors
2363 /// Throws a `TypeError` if no duration field is set; see [`PlainDateTime::subtract`] for the remaining errors.
2364 #[wasm_bindgen(method, js_name = subtract, catch)]
2365 pub fn subtract_with_duration_like(
2366 this: &PlainDateTime,
2367 duration: &DurationLike,
2368 ) -> Result<PlainDateTime, Error>;
2369
2370 /// The `subtract()` method taking a duration property bag and options; see
2371 /// [`PlainDateTime::subtract_with_duration_like`] for errors.
2372 #[wasm_bindgen(method, js_name = subtract, catch)]
2373 pub fn subtract_with_duration_like_and_options(
2374 this: &PlainDateTime,
2375 duration: &DurationLike,
2376 options: &OverflowOptions,
2377 ) -> Result<PlainDateTime, Error>;
2378
2379 /// The `subtract()` method taking an ISO 8601 duration string and options; see
2380 /// [`PlainDateTime::subtract_with_str`] for errors.
2381 #[wasm_bindgen(method, js_name = subtract, catch)]
2382 pub fn subtract_with_str_and_options(
2383 this: &PlainDateTime,
2384 duration: &str,
2385 options: &OverflowOptions,
2386 ) -> Result<PlainDateTime, RangeError>;
2387
2388 /// The `subtract()` method taking an ISO 8601 duration string.
2389 ///
2390 /// # Errors
2391 /// Throws a `RangeError` if the string is not a valid duration; see [`PlainDateTime::subtract`] for the remaining errors.
2392 #[wasm_bindgen(method, js_name = subtract, catch)]
2393 pub fn subtract_with_str(
2394 this: &PlainDateTime,
2395 duration: &str,
2396 ) -> Result<PlainDateTime, RangeError>;
2397
2398 /// The `until()` method returns a `Temporal.Duration` representing the duration
2399 /// from this date-time until `other`.
2400 ///
2401 /// # Errors
2402 /// Throws a `RangeError` if datetimes have different calendars or options are invalid.
2403 ///
2404 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/until)
2405 #[wasm_bindgen(method, catch)]
2406 pub fn until(this: &PlainDateTime, other: &PlainDateTime) -> Result<Duration, RangeError>;
2407
2408 /// The `until()` method returns a `Temporal.Duration` representing the duration
2409 /// from this date-time until `other`.
2410 ///
2411 /// # Errors
2412 /// Throws a `RangeError` if datetimes have different calendars or options are invalid.
2413 ///
2414 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/until)
2415 #[wasm_bindgen(method, js_name = until, catch)]
2416 pub fn until_with_options(
2417 this: &PlainDateTime,
2418 other: &PlainDateTime,
2419 options: &DifferenceOptions,
2420 ) -> Result<Duration, RangeError>;
2421
2422 /// The `since()` method returns a `Temporal.Duration` representing the duration
2423 /// from `other` until this date-time.
2424 ///
2425 /// # Errors
2426 /// Throws a `RangeError` if datetimes have different calendars or options are invalid.
2427 ///
2428 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/since)
2429 #[wasm_bindgen(method, catch)]
2430 pub fn since(this: &PlainDateTime, other: &PlainDateTime) -> Result<Duration, RangeError>;
2431
2432 /// The `until()` method taking a `Temporal.PlainDate`; see [`PlainDateTime::until`] for errors.
2433 #[wasm_bindgen(method, js_name = until, catch)]
2434 pub fn until_with_plain_date(
2435 this: &PlainDateTime,
2436 other: &PlainDate,
2437 ) -> Result<Duration, RangeError>;
2438
2439 /// The `until()` method taking a `Temporal.PlainDate` and options; see [`PlainDateTime::until_with_options`]
2440 /// for errors.
2441 #[wasm_bindgen(method, js_name = until, catch)]
2442 pub fn until_with_plain_date_and_options(
2443 this: &PlainDateTime,
2444 other: &PlainDate,
2445 options: &DifferenceOptions,
2446 ) -> Result<Duration, RangeError>;
2447
2448 /// The `until()` method taking a `Temporal.ZonedDateTime`; see [`PlainDateTime::until`] for errors.
2449 #[wasm_bindgen(method, js_name = until, catch)]
2450 pub fn until_with_zoned_date_time(
2451 this: &PlainDateTime,
2452 other: &ZonedDateTime,
2453 ) -> Result<Duration, RangeError>;
2454
2455 /// The `until()` method taking a `Temporal.ZonedDateTime` and options; see [`PlainDateTime::until_with_options`]
2456 /// for errors.
2457 #[wasm_bindgen(method, js_name = until, catch)]
2458 pub fn until_with_zoned_date_time_and_options(
2459 this: &PlainDateTime,
2460 other: &ZonedDateTime,
2461 options: &DifferenceOptions,
2462 ) -> Result<Duration, RangeError>;
2463
2464 /// The `until()` method taking a property bag; throws a `TypeError` if required fields are missing; see [`PlainDateTime::until`] for the remaining errors.
2465 #[wasm_bindgen(method, js_name = until, catch)]
2466 pub fn until_with_plain_date_time_like(
2467 this: &PlainDateTime,
2468 other: &PlainDateTimeLike,
2469 ) -> Result<Duration, Error>;
2470
2471 /// The `until()` method taking a property bag and options; throws a `TypeError` if required
2472 /// fields are missing. See [`PlainDateTime::until_with_options`] for the remaining errors.
2473 #[wasm_bindgen(method, js_name = until, catch)]
2474 pub fn until_with_plain_date_time_like_and_options(
2475 this: &PlainDateTime,
2476 other: &PlainDateTimeLike,
2477 options: &DifferenceOptions,
2478 ) -> Result<Duration, Error>;
2479
2480 /// The `until()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`PlainDateTime::until`] for the remaining errors.
2481 #[wasm_bindgen(method, js_name = until, catch)]
2482 pub fn until_with_str(this: &PlainDateTime, other: &str) -> Result<Duration, RangeError>;
2483
2484 /// The `until()` method taking an ISO 8601 string and options; see [`PlainDateTime::until_with_options`]
2485 /// for errors.
2486 #[wasm_bindgen(method, js_name = until, catch)]
2487 pub fn until_with_str_and_options(
2488 this: &PlainDateTime,
2489 other: &str,
2490 options: &DifferenceOptions,
2491 ) -> Result<Duration, RangeError>;
2492
2493 /// The `since()` method returns a `Temporal.Duration` representing the duration
2494 /// from `other` until this date-time.
2495 ///
2496 /// # Errors
2497 /// Throws a `RangeError` if datetimes have different calendars or options are invalid.
2498 ///
2499 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/since)
2500 #[wasm_bindgen(method, js_name = since, catch)]
2501 pub fn since_with_options(
2502 this: &PlainDateTime,
2503 other: &PlainDateTime,
2504 options: &DifferenceOptions,
2505 ) -> Result<Duration, RangeError>;
2506
2507 /// The `round()` method returns a new `Temporal.PlainDateTime` object with the
2508 /// date-time rounded to the given unit.
2509 ///
2510 /// # Errors
2511 /// Throws a `RangeError` if `smallestUnit` is not provided, specifies invalid units,
2512 /// or if `roundingIncrement` is invalid for the unit.
2513 ///
2514 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/round)
2515 #[wasm_bindgen(method, js_name = round, catch)]
2516 pub fn round(
2517 this: &PlainDateTime,
2518 round_to: &RoundToOptions,
2519 ) -> Result<PlainDateTime, RangeError>;
2520
2521 /// The `since()` method taking a `Temporal.PlainDate`; see [`PlainDateTime::since`] for errors.
2522 #[wasm_bindgen(method, js_name = since, catch)]
2523 pub fn since_with_plain_date(
2524 this: &PlainDateTime,
2525 other: &PlainDate,
2526 ) -> Result<Duration, RangeError>;
2527
2528 /// The `since()` method taking a `Temporal.PlainDate` and options; see [`PlainDateTime::since_with_options`]
2529 /// for errors.
2530 #[wasm_bindgen(method, js_name = since, catch)]
2531 pub fn since_with_plain_date_and_options(
2532 this: &PlainDateTime,
2533 other: &PlainDate,
2534 options: &DifferenceOptions,
2535 ) -> Result<Duration, RangeError>;
2536
2537 /// The `since()` method taking a `Temporal.ZonedDateTime`; see [`PlainDateTime::since`] for errors.
2538 #[wasm_bindgen(method, js_name = since, catch)]
2539 pub fn since_with_zoned_date_time(
2540 this: &PlainDateTime,
2541 other: &ZonedDateTime,
2542 ) -> Result<Duration, RangeError>;
2543
2544 /// The `since()` method taking a `Temporal.ZonedDateTime` and options; see [`PlainDateTime::since_with_options`]
2545 /// for errors.
2546 #[wasm_bindgen(method, js_name = since, catch)]
2547 pub fn since_with_zoned_date_time_and_options(
2548 this: &PlainDateTime,
2549 other: &ZonedDateTime,
2550 options: &DifferenceOptions,
2551 ) -> Result<Duration, RangeError>;
2552
2553 /// The `since()` method taking a property bag; throws a `TypeError` if required fields are missing; see [`PlainDateTime::since`] for the remaining errors.
2554 #[wasm_bindgen(method, js_name = since, catch)]
2555 pub fn since_with_plain_date_time_like(
2556 this: &PlainDateTime,
2557 other: &PlainDateTimeLike,
2558 ) -> Result<Duration, Error>;
2559
2560 /// The `since()` method taking a property bag and options; throws a `TypeError` if required
2561 /// fields are missing. See [`PlainDateTime::since_with_options`] for the remaining errors.
2562 #[wasm_bindgen(method, js_name = since, catch)]
2563 pub fn since_with_plain_date_time_like_and_options(
2564 this: &PlainDateTime,
2565 other: &PlainDateTimeLike,
2566 options: &DifferenceOptions,
2567 ) -> Result<Duration, Error>;
2568
2569 /// The `since()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`PlainDateTime::since`] for the remaining errors.
2570 #[wasm_bindgen(method, js_name = since, catch)]
2571 pub fn since_with_str(this: &PlainDateTime, other: &str) -> Result<Duration, RangeError>;
2572
2573 /// The `since()` method taking an ISO 8601 string and options; see [`PlainDateTime::since_with_options`]
2574 /// for errors.
2575 #[wasm_bindgen(method, js_name = since, catch)]
2576 pub fn since_with_str_and_options(
2577 this: &PlainDateTime,
2578 other: &str,
2579 options: &DifferenceOptions,
2580 ) -> Result<Duration, RangeError>;
2581
2582 /// Shorthand for `round()` with only `smallestUnit` set.
2583 #[wasm_bindgen(method, js_name = round, catch)]
2584 pub fn round_with_unit(
2585 this: &PlainDateTime,
2586 smallest_unit: Unit,
2587 ) -> Result<PlainDateTime, RangeError>;
2588
2589 /// The `toZonedDateTime()` method returns a `Temporal.ZonedDateTime` with the
2590 /// same calendar date and wall-clock time in the given time zone.
2591 ///
2592 /// # Errors
2593 /// Throws a `RangeError` if `time_zone` is not a valid time zone identifier,
2594 /// or if `disambiguation` is `'reject'` and the wall-clock time is ambiguous
2595 /// or does not exist in that time zone.
2596 ///
2597 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toZonedDateTime)
2598 #[wasm_bindgen(method, js_name = toZonedDateTime, catch)]
2599 pub fn to_zoned_date_time(
2600 this: &PlainDateTime,
2601 time_zone: &str,
2602 ) -> Result<ZonedDateTime, RangeError>;
2603
2604 /// The `toZonedDateTime()` method returns a `Temporal.ZonedDateTime` with the
2605 /// same calendar date and wall-clock time in the given time zone.
2606 ///
2607 /// # Errors
2608 /// Throws a `RangeError` if `time_zone` is not a valid time zone identifier,
2609 /// or if `disambiguation` is `'reject'` and the wall-clock time is ambiguous
2610 /// or does not exist in that time zone.
2611 ///
2612 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toZonedDateTime)
2613 #[wasm_bindgen(method, js_name = toZonedDateTime, catch)]
2614 pub fn to_zoned_date_time_with_options(
2615 this: &PlainDateTime,
2616 time_zone: &str,
2617 options: &DisambiguationOptions,
2618 ) -> Result<ZonedDateTime, RangeError>;
2619
2620 /// The `toZonedDateTime()` method in the time zone of the given
2621 /// `Temporal.ZonedDateTime`; see [`PlainDateTime::to_zoned_date_time`] for errors.
2622 #[wasm_bindgen(method, js_name = toZonedDateTime, catch)]
2623 pub fn to_zoned_date_time_with_zoned_date_time(
2624 this: &PlainDateTime,
2625 time_zone: &ZonedDateTime,
2626 ) -> Result<ZonedDateTime, RangeError>;
2627
2628 /// The `toZonedDateTime()` method in the time zone of the given
2629 /// `Temporal.ZonedDateTime`; see [`PlainDateTime::to_zoned_date_time`] for errors.
2630 #[wasm_bindgen(method, js_name = toZonedDateTime, catch)]
2631 pub fn to_zoned_date_time_with_zoned_date_time_and_options(
2632 this: &PlainDateTime,
2633 time_zone: &ZonedDateTime,
2634 options: &DisambiguationOptions,
2635 ) -> Result<ZonedDateTime, RangeError>;
2636
2637 /// The `toPlainDate()` method returns a `Temporal.PlainDate` object representing
2638 /// the date part of this date-time.
2639 ///
2640 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toPlainDate)
2641 #[wasm_bindgen(method, js_name = toPlainDate)]
2642 pub fn to_plain_date(this: &PlainDateTime) -> PlainDate;
2643
2644 /// The `toPlainTime()` method returns a `Temporal.PlainTime` object representing
2645 /// the time part of this date-time.
2646 ///
2647 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toPlainTime)
2648 #[wasm_bindgen(method, js_name = toPlainTime)]
2649 pub fn to_plain_time(this: &PlainDateTime) -> PlainTime;
2650
2651 /// The `toLocaleString()` method returns a language-sensitive string representation
2652 /// of this date-time.
2653 ///
2654 /// # Errors
2655 /// Throws a `RangeError` if `locales` is invalid or the locale's calendar does
2656 /// not match this value's calendar.
2657 ///
2658 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toLocaleString)
2659 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
2660 pub fn to_locale_string(this: &PlainDateTime) -> Result<JsString, RangeError>;
2661
2662 /// The `toLocaleString()` method; see [`PlainDateTime::to_locale_string`] for errors.
2663 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
2664 pub fn to_locale_string_with_str(
2665 this: &PlainDateTime,
2666 locales: &str,
2667 ) -> Result<JsString, RangeError>;
2668
2669 /// The `toLocaleString()` method; see [`PlainDateTime::to_locale_string`] for errors.
2670 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
2671 pub fn to_locale_string_with_str_sequence(
2672 this: &PlainDateTime,
2673 locales: &[JsString],
2674 ) -> Result<JsString, RangeError>;
2675
2676 /// The `toLocaleString()` method with options; throws a `TypeError` if an option does not
2677 /// apply to this type or conflicts with another. See [`PlainDateTime::to_locale_string`] for the
2678 /// remaining errors.
2679 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
2680 pub fn to_locale_string_with_str_sequence_and_options(
2681 this: &PlainDateTime,
2682 locales: &[JsString],
2683 options: &Intl::DateTimeFormatOptions,
2684 ) -> Result<JsString, Error>;
2685
2686 /// The `toLocaleString()` method with options; `None` for `locales` uses the default locale.
2687 /// Throws a `TypeError` if an option does not apply to this type or conflicts with another.
2688 /// See [`PlainDateTime::to_locale_string`] for the remaining errors.
2689 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
2690 pub fn to_locale_string_with_options(
2691 this: &PlainDateTime,
2692 locales: Option<&str>,
2693 options: &Intl::DateTimeFormatOptions,
2694 ) -> Result<JsString, Error>;
2695
2696 /// The `toJSON()` method returns a string representation of this date-time suitable
2697 /// for JSON serialization.
2698 ///
2699 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toJSON)
2700 #[wasm_bindgen(method, js_name = toJSON)]
2701 pub fn to_json(this: &PlainDateTime) -> JsString;
2702
2703 /// The `toString()` method returns an RFC 9557 string representation of this date-time.
2704 ///
2705 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toString)
2706 #[wasm_bindgen(method, js_name = toString)]
2707 pub fn to_js_string(this: &PlainDateTime) -> JsString;
2708
2709 /// The `toString()` method returns an RFC 9557 string representation of this date-time,
2710 /// formatted according to `options`.
2711 ///
2712 /// # Errors
2713 /// Throws a `RangeError` if the options are invalid for this type.
2714 ///
2715 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime/toString)
2716 #[wasm_bindgen(method, js_name = toString, catch)]
2717 pub fn to_js_string_with_options(
2718 this: &PlainDateTime,
2719 options: &CalendarTypeToStringOptions,
2720 ) -> Result<JsString, RangeError>;
2721}
2722
2723#[wasm_bindgen]
2724extern "C" {
2725 /// A `Temporal.ZonedDateTime` is a timezone-aware, calendar-aware date/time object
2726 /// that represents a real event that has happened (or will happen) at a particular
2727 /// exact time from the perspective of a particular region on Earth.
2728 ///
2729 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime)
2730 #[wasm_bindgen(js_namespace = Temporal, extends = Object)]
2731 #[derive(Clone, Debug)]
2732 pub type ZonedDateTime;
2733
2734 /// The `Temporal.ZonedDateTime()` constructor creates `Temporal.ZonedDateTime` objects
2735 /// in the ISO 8601 calendar.
2736 ///
2737 /// # Errors
2738 /// Throws a `RangeError` if `epoch_nanoseconds` is outside the valid range or
2739 /// `time_zone` is not a valid time zone identifier.
2740 ///
2741 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/ZonedDateTime)
2742 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
2743 pub fn new(epoch_nanoseconds: &BigInt, time_zone: &str) -> Result<ZonedDateTime, RangeError>;
2744
2745 /// The `Temporal.ZonedDateTime()` constructor creates `Temporal.ZonedDateTime` objects
2746 /// in the given calendar.
2747 ///
2748 /// # Errors
2749 /// Throws a `RangeError` if `epoch_nanoseconds` is outside the valid range or
2750 /// `time_zone` is not a valid time zone identifier.
2751 /// Throws a `RangeError` if `calendar` is not a supported calendar identifier.
2752 ///
2753 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/ZonedDateTime)
2754 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
2755 pub fn new_with_calendar(
2756 epoch_nanoseconds: &BigInt,
2757 time_zone: &str,
2758 calendar: &str,
2759 ) -> Result<ZonedDateTime, RangeError>;
2760
2761 /// The `Temporal.ZonedDateTime.from()` static method creates a new `Temporal.ZonedDateTime`
2762 /// object from another value.
2763 ///
2764 /// # Errors
2765 /// Throws a `RangeError` if the string is invalid, values are out of range
2766 /// (when `overflow` is `'reject'`), or the offset is invalid (when `offset` is `'reject'`).
2767 ///
2768 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/from)
2769 #[wasm_bindgen(static_method_of = ZonedDateTime, js_namespace = Temporal, js_name = from, catch)]
2770 pub fn from_with_str(item: &str) -> Result<ZonedDateTime, RangeError>;
2771
2772 /// The `Temporal.ZonedDateTime.from()` static method; see [`ZonedDateTime::from_with_str`] for errors.
2773 #[wasm_bindgen(static_method_of = ZonedDateTime, js_namespace = Temporal, js_name = from, catch)]
2774 pub fn from_with_str_and_options(
2775 item: &str,
2776 options: &ZonedDateTimeAssignmentOptions,
2777 ) -> Result<ZonedDateTime, RangeError>;
2778
2779 /// The `Temporal.ZonedDateTime.from()` static method taking a property bag; throws a `TypeError` if
2780 /// required fields are missing. See [`ZonedDateTime::from_with_str`] for the remaining errors.
2781 #[wasm_bindgen(static_method_of = ZonedDateTime, js_namespace = Temporal, js_name = from, catch)]
2782 pub fn from_with_zoned_date_time_like(item: &ZonedDateTimeLike)
2783 -> Result<ZonedDateTime, Error>;
2784
2785 /// The `Temporal.ZonedDateTime.from()` static method taking a property bag; throws a `TypeError` if
2786 /// required fields are missing. See [`ZonedDateTime::from_with_str`] for the remaining errors.
2787 #[wasm_bindgen(static_method_of = ZonedDateTime, js_namespace = Temporal, js_name = from, catch)]
2788 pub fn from_with_zoned_date_time_like_and_options(
2789 item: &ZonedDateTimeLike,
2790 options: &ZonedDateTimeAssignmentOptions,
2791 ) -> Result<ZonedDateTime, Error>;
2792
2793 /// The `Temporal.ZonedDateTime.from()` static method.
2794 #[wasm_bindgen(static_method_of = ZonedDateTime, js_namespace = Temporal, js_name = from)]
2795 pub fn from_with_zoned_date_time(item: &ZonedDateTime) -> ZonedDateTime;
2796
2797 /// The `Temporal.ZonedDateTime.from()` static method.
2798 #[wasm_bindgen(static_method_of = ZonedDateTime, js_namespace = Temporal, js_name = from)]
2799 pub fn from_with_zoned_date_time_and_options(
2800 item: &ZonedDateTime,
2801 options: &ZonedDateTimeAssignmentOptions,
2802 ) -> ZonedDateTime;
2803
2804 /// The `Temporal.ZonedDateTime.compare()` static method returns -1, 0, or 1 depending
2805 /// on whether `one` comes before, is equal to, or comes after `two`.
2806 ///
2807 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/compare)
2808 #[wasm_bindgen(static_method_of = ZonedDateTime, js_namespace = Temporal)]
2809 pub fn compare(one: &ZonedDateTime, two: &ZonedDateTime) -> i32;
2810
2811 /// The `era` accessor property returns a calendar-specific lowercase string
2812 /// representing the era of this date, or `None` if the calendar does not use eras.
2813 ///
2814 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/era)
2815 #[wasm_bindgen(method, getter)]
2816 pub fn era(this: &ZonedDateTime) -> Option<JsString>;
2817
2818 /// The `eraYear` accessor property returns a non-negative integer representing the
2819 /// year of this date within the era, or `None` if the calendar does not use eras.
2820 ///
2821 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/eraYear)
2822 #[wasm_bindgen(method, getter = eraYear)]
2823 pub fn era_year(this: &ZonedDateTime) -> Option<i32>;
2824
2825 /// The `year` accessor property returns an integer representing the number of years
2826 /// of this date relative to the start of a calendar-specific epoch year.
2827 ///
2828 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/year)
2829 #[wasm_bindgen(method, getter)]
2830 pub fn year(this: &ZonedDateTime) -> i32;
2831
2832 /// The `month` accessor property returns a positive integer representing the
2833 /// 1-based month index in the year of this date.
2834 ///
2835 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/month)
2836 #[wasm_bindgen(method, getter)]
2837 pub fn month(this: &ZonedDateTime) -> u32;
2838
2839 /// The `monthCode` accessor property returns a calendar-specific string representing
2840 /// the month of this date.
2841 ///
2842 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/monthCode)
2843 #[wasm_bindgen(method, getter = monthCode)]
2844 pub fn month_code(this: &ZonedDateTime) -> JsString;
2845
2846 /// The `day` accessor property returns a positive integer representing the
2847 /// 1-based day index in the month of this date.
2848 ///
2849 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/day)
2850 #[wasm_bindgen(method, getter)]
2851 pub fn day(this: &ZonedDateTime) -> u32;
2852
2853 /// The `hour` accessor property returns an integer from 0 to 23 representing
2854 /// the hour component of this time.
2855 ///
2856 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/hour)
2857 #[wasm_bindgen(method, getter)]
2858 pub fn hour(this: &ZonedDateTime) -> u32;
2859
2860 /// The `minute` accessor property returns an integer from 0 to 59 representing
2861 /// the minute component of this time.
2862 ///
2863 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/minute)
2864 #[wasm_bindgen(method, getter)]
2865 pub fn minute(this: &ZonedDateTime) -> u32;
2866
2867 /// The `second` accessor property returns an integer from 0 to 59 representing
2868 /// the second component of this time.
2869 ///
2870 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/second)
2871 #[wasm_bindgen(method, getter)]
2872 pub fn second(this: &ZonedDateTime) -> u32;
2873
2874 /// The `millisecond` accessor property returns an integer from 0 to 999 representing
2875 /// the millisecond component of this time.
2876 ///
2877 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/millisecond)
2878 #[wasm_bindgen(method, getter)]
2879 pub fn millisecond(this: &ZonedDateTime) -> u32;
2880
2881 /// The `microsecond` accessor property returns an integer from 0 to 999 representing
2882 /// the microsecond component of this time.
2883 ///
2884 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/microsecond)
2885 #[wasm_bindgen(method, getter)]
2886 pub fn microsecond(this: &ZonedDateTime) -> u32;
2887
2888 /// The `nanosecond` accessor property returns an integer from 0 to 999 representing
2889 /// the nanosecond component of this time.
2890 ///
2891 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/nanosecond)
2892 #[wasm_bindgen(method, getter)]
2893 pub fn nanosecond(this: &ZonedDateTime) -> u32;
2894
2895 /// The `timeZoneId` accessor property returns a string representing the time zone
2896 /// identifier used to interpret the internal instant.
2897 ///
2898 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/timeZoneId)
2899 #[wasm_bindgen(method, getter = timeZoneId)]
2900 pub fn time_zone_id(this: &ZonedDateTime) -> JsString;
2901
2902 /// The `calendarId` accessor property returns a string representing the calendar
2903 /// used to interpret the internal ISO 8601 date.
2904 ///
2905 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/calendarId)
2906 #[wasm_bindgen(method, getter = calendarId)]
2907 pub fn calendar_id(this: &ZonedDateTime) -> JsString;
2908
2909 /// The `dayOfWeek` accessor property returns a positive integer representing the
2910 /// day of the week of this date (1 = Monday through 7 = Sunday for ISO 8601).
2911 ///
2912 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/dayOfWeek)
2913 #[wasm_bindgen(method, getter = dayOfWeek)]
2914 pub fn day_of_week(this: &ZonedDateTime) -> u32;
2915
2916 /// The `dayOfYear` accessor property returns a positive integer representing the
2917 /// 1-based day index of this date in the year.
2918 ///
2919 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/dayOfYear)
2920 #[wasm_bindgen(method, getter = dayOfYear)]
2921 pub fn day_of_year(this: &ZonedDateTime) -> u32;
2922
2923 /// The `weekOfYear` accessor property returns a positive integer representing the
2924 /// 1-based week index in the `yearOfWeek` of this date, or `None` if the
2925 /// calendar does not have a well-defined week system.
2926 ///
2927 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/weekOfYear)
2928 #[wasm_bindgen(method, getter = weekOfYear)]
2929 pub fn week_of_year(this: &ZonedDateTime) -> Option<u32>;
2930
2931 /// The `yearOfWeek` accessor property returns an integer representing the year
2932 /// to be paired with `weekOfYear`, or `None` if the calendar does not have
2933 /// a well-defined week system.
2934 ///
2935 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/yearOfWeek)
2936 #[wasm_bindgen(method, getter = yearOfWeek)]
2937 pub fn year_of_week(this: &ZonedDateTime) -> Option<i32>;
2938
2939 /// The `hoursInDay` accessor property returns a positive number representing the
2940 /// number of hours in the current day. Usually 24, but may differ due to DST.
2941 ///
2942 /// # Errors
2943 /// Throws a `RangeError` if the start of this or the following day falls outside the representable instant range.
2944 ///
2945 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/hoursInDay)
2946 #[wasm_bindgen(method, getter = hoursInDay, catch)]
2947 pub fn hours_in_day(this: &ZonedDateTime) -> Result<f64, RangeError>;
2948
2949 /// The `daysInWeek` accessor property returns a positive integer representing the
2950 /// number of days in the week of this date.
2951 ///
2952 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/daysInWeek)
2953 #[wasm_bindgen(method, getter = daysInWeek)]
2954 pub fn days_in_week(this: &ZonedDateTime) -> u32;
2955
2956 /// The `daysInMonth` accessor property returns a positive integer representing the
2957 /// number of days in the month of this date.
2958 ///
2959 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/daysInMonth)
2960 #[wasm_bindgen(method, getter = daysInMonth)]
2961 pub fn days_in_month(this: &ZonedDateTime) -> u32;
2962
2963 /// The `daysInYear` accessor property returns a positive integer representing the
2964 /// number of days in the year of this date.
2965 ///
2966 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/daysInYear)
2967 #[wasm_bindgen(method, getter = daysInYear)]
2968 pub fn days_in_year(this: &ZonedDateTime) -> u32;
2969
2970 /// The `monthsInYear` accessor property returns a positive integer representing the
2971 /// number of months in the year of this date.
2972 ///
2973 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/monthsInYear)
2974 #[wasm_bindgen(method, getter = monthsInYear)]
2975 pub fn months_in_year(this: &ZonedDateTime) -> u32;
2976
2977 /// The `inLeapYear` accessor property returns `true` if this date is in a leap year,
2978 /// and `false` otherwise.
2979 ///
2980 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/inLeapYear)
2981 #[wasm_bindgen(method, getter = inLeapYear)]
2982 pub fn in_leap_year(this: &ZonedDateTime) -> bool;
2983
2984 /// The `offsetNanoseconds` accessor property returns an integer representing the
2985 /// offset from UTC in nanoseconds.
2986 ///
2987 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/offsetNanoseconds)
2988 #[wasm_bindgen(method, getter = offsetNanoseconds)]
2989 pub fn offset_nanoseconds(this: &ZonedDateTime) -> f64;
2990
2991 /// The `offset` accessor property returns a string representing the offset from UTC
2992 /// (e.g., '-08:00' or '+05:30').
2993 ///
2994 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/offset)
2995 #[wasm_bindgen(method, getter)]
2996 pub fn offset(this: &ZonedDateTime) -> JsString;
2997
2998 /// The `epochMilliseconds` accessor property returns an integer representing the
2999 /// number of milliseconds since the Unix epoch.
3000 ///
3001 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/epochMilliseconds)
3002 #[wasm_bindgen(method, getter = epochMilliseconds)]
3003 pub fn epoch_milliseconds(this: &ZonedDateTime) -> f64;
3004
3005 /// The `epochNanoseconds` accessor property returns a BigInt representing the
3006 /// number of nanoseconds since the Unix epoch.
3007 ///
3008 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/epochNanoseconds)
3009 #[wasm_bindgen(method, getter = epochNanoseconds)]
3010 pub fn epoch_nanoseconds(this: &ZonedDateTime) -> BigInt;
3011
3012 /// The `equals()` method returns `true` if this zoned date-time is equivalent to `other`.
3013 ///
3014 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/equals)
3015 #[wasm_bindgen(method)]
3016 pub fn equals(this: &ZonedDateTime, other: &ZonedDateTime) -> bool;
3017
3018 /// The `with()` method returns a new `Temporal.ZonedDateTime` object with some fields
3019 /// replaced by new values.
3020 ///
3021 /// # Errors
3022 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
3023 /// of range, `overflow` is `'reject'` and a field would need constraining, or the offset is
3024 /// invalid and `offset` is `'reject'`.
3025 ///
3026 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/with)
3027 #[wasm_bindgen(method, catch)]
3028 pub fn with(this: &ZonedDateTime, fields: &ZonedDateTimeFields)
3029 -> Result<ZonedDateTime, Error>;
3030
3031 /// The `equals()` method taking a property bag; throws a `TypeError` if required fields are missing.
3032 #[wasm_bindgen(method, js_name = equals, catch)]
3033 pub fn equals_with_zoned_date_time_like(
3034 this: &ZonedDateTime,
3035 other: &ZonedDateTimeLike,
3036 ) -> Result<bool, Error>;
3037
3038 /// The `equals()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
3039 #[wasm_bindgen(method, js_name = equals, catch)]
3040 pub fn equals_with_str(this: &ZonedDateTime, other: &str) -> Result<bool, RangeError>;
3041
3042 /// The `with()` method returns a new `Temporal.ZonedDateTime` object with some fields
3043 /// replaced by new values.
3044 ///
3045 /// # Errors
3046 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
3047 /// of range, `overflow` is `'reject'` and a field would need constraining, or the offset is
3048 /// invalid and `offset` is `'reject'`.
3049 ///
3050 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/with)
3051 #[wasm_bindgen(method, js_name = with, catch)]
3052 pub fn with_with_options(
3053 this: &ZonedDateTime,
3054 fields: &ZonedDateTimeFields,
3055 options: &ZonedDateTimeAssignmentOptions,
3056 ) -> Result<ZonedDateTime, Error>;
3057
3058 /// The `withPlainTime()` method returns a new `Temporal.ZonedDateTime` object with
3059 /// the time part replaced by the given time (or the start of the day if not provided).
3060 ///
3061 /// # Errors
3062 /// Throws a `RangeError` if the result falls outside the representable range.
3063 ///
3064 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/withPlainTime)
3065 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
3066 pub fn with_plain_time(this: &ZonedDateTime) -> Result<ZonedDateTime, RangeError>;
3067
3068 /// The `withPlainTime()` method returns a new `Temporal.ZonedDateTime` object with
3069 /// the time part replaced by the given time (or the start of the day if not provided).
3070 ///
3071 /// # Errors
3072 /// Throws a `RangeError` if the result falls outside the representable range.
3073 ///
3074 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/withPlainTime)
3075 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
3076 pub fn with_plain_time_with_plain_time(
3077 this: &ZonedDateTime,
3078 plain_time: &PlainTime,
3079 ) -> Result<ZonedDateTime, RangeError>;
3080
3081 /// The `withCalendar()` method returns a new `Temporal.ZonedDateTime` object with
3082 /// the calendar replaced.
3083 ///
3084 /// # Errors
3085 /// Throws a `RangeError` if the calendar identifier is invalid.
3086 ///
3087 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/withCalendar)
3088 #[wasm_bindgen(method, js_name = withCalendar, catch)]
3089 pub fn with_calendar(this: &ZonedDateTime, calendar: &str)
3090 -> Result<ZonedDateTime, RangeError>;
3091
3092 /// The `withPlainTime()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`ZonedDateTime::with_plain_time`] for the remaining errors.
3093 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
3094 pub fn with_plain_time_with_str(
3095 this: &ZonedDateTime,
3096 plain_time: &str,
3097 ) -> Result<ZonedDateTime, RangeError>;
3098
3099 /// The `withPlainTime()` method taking a property bag; throws a `TypeError` if no time field is present; see [`ZonedDateTime::with_plain_time`] for the remaining errors.
3100 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
3101 pub fn with_plain_time_with_plain_time_like(
3102 this: &ZonedDateTime,
3103 plain_time: &PlainTimeLike,
3104 ) -> Result<ZonedDateTime, Error>;
3105
3106 /// The `withPlainTime()` method taking a `Temporal.PlainDateTime`; see [`ZonedDateTime::with_plain_time`] for errors.
3107 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
3108 pub fn with_plain_time_with_plain_date_time(
3109 this: &ZonedDateTime,
3110 plain_time: &PlainDateTime,
3111 ) -> Result<ZonedDateTime, RangeError>;
3112
3113 /// The `withPlainTime()` method taking a `Temporal.ZonedDateTime`; see [`ZonedDateTime::with_plain_time`] for errors.
3114 #[wasm_bindgen(method, js_name = withPlainTime, catch)]
3115 pub fn with_plain_time_with_zoned_date_time(
3116 this: &ZonedDateTime,
3117 plain_time: &ZonedDateTime,
3118 ) -> Result<ZonedDateTime, RangeError>;
3119
3120 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainDate`.
3121 #[wasm_bindgen(method, js_name = withCalendar)]
3122 pub fn with_calendar_with_plain_date(
3123 this: &ZonedDateTime,
3124 calendar: &PlainDate,
3125 ) -> ZonedDateTime;
3126
3127 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainDateTime`.
3128 #[wasm_bindgen(method, js_name = withCalendar)]
3129 pub fn with_calendar_with_plain_date_time(
3130 this: &ZonedDateTime,
3131 calendar: &PlainDateTime,
3132 ) -> ZonedDateTime;
3133
3134 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainYearMonth`.
3135 #[wasm_bindgen(method, js_name = withCalendar)]
3136 pub fn with_calendar_with_plain_year_month(
3137 this: &ZonedDateTime,
3138 calendar: &PlainYearMonth,
3139 ) -> ZonedDateTime;
3140
3141 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainMonthDay`.
3142 #[wasm_bindgen(method, js_name = withCalendar)]
3143 pub fn with_calendar_with_plain_month_day(
3144 this: &ZonedDateTime,
3145 calendar: &PlainMonthDay,
3146 ) -> ZonedDateTime;
3147
3148 /// The `withCalendar()` method taking the calendar of the given `Temporal.ZonedDateTime`.
3149 #[wasm_bindgen(method, js_name = withCalendar)]
3150 pub fn with_calendar_with_zoned_date_time(
3151 this: &ZonedDateTime,
3152 calendar: &ZonedDateTime,
3153 ) -> ZonedDateTime;
3154
3155 /// The `withTimeZone()` method returns a new `Temporal.ZonedDateTime` object
3156 /// representing the same instant in the given time zone.
3157 ///
3158 /// # Errors
3159 /// Throws a `RangeError` if `time_zone` is not a valid time zone identifier.
3160 ///
3161 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/withTimeZone)
3162 #[wasm_bindgen(method, js_name = withTimeZone, catch)]
3163 pub fn with_time_zone(
3164 this: &ZonedDateTime,
3165 time_zone: &str,
3166 ) -> Result<ZonedDateTime, RangeError>;
3167
3168 /// The `withTimeZone()` method taking the time zone of the given `Temporal.ZonedDateTime`.
3169 #[wasm_bindgen(method, js_name = withTimeZone)]
3170 pub fn with_time_zone_with_zoned_date_time(
3171 this: &ZonedDateTime,
3172 time_zone: &ZonedDateTime,
3173 ) -> ZonedDateTime;
3174
3175 /// The `add()` method returns a new `Temporal.ZonedDateTime` object with the
3176 /// duration added to this zoned date-time.
3177 ///
3178 /// # Errors
3179 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
3180 /// field would need constraining.
3181 ///
3182 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/add)
3183 #[wasm_bindgen(method, catch)]
3184 pub fn add(this: &ZonedDateTime, duration: &Duration) -> Result<ZonedDateTime, RangeError>;
3185
3186 /// The `add()` method returns a new `Temporal.ZonedDateTime` object with the
3187 /// duration added to this zoned date-time.
3188 ///
3189 /// # Errors
3190 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
3191 /// field would need constraining.
3192 ///
3193 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/add)
3194 #[wasm_bindgen(method, js_name = add, catch)]
3195 pub fn add_with_options(
3196 this: &ZonedDateTime,
3197 duration: &Duration,
3198 options: &OverflowOptions,
3199 ) -> Result<ZonedDateTime, RangeError>;
3200
3201 /// The `add()` method taking a duration property bag.
3202 ///
3203 /// # Errors
3204 /// Throws a `TypeError` if no duration field is set; see [`ZonedDateTime::add`] for the remaining errors.
3205 #[wasm_bindgen(method, js_name = add, catch)]
3206 pub fn add_with_duration_like(
3207 this: &ZonedDateTime,
3208 duration: &DurationLike,
3209 ) -> Result<ZonedDateTime, Error>;
3210
3211 /// The `add()` method taking a duration property bag and options; see
3212 /// [`ZonedDateTime::add_with_duration_like`] for errors.
3213 #[wasm_bindgen(method, js_name = add, catch)]
3214 pub fn add_with_duration_like_and_options(
3215 this: &ZonedDateTime,
3216 duration: &DurationLike,
3217 options: &OverflowOptions,
3218 ) -> Result<ZonedDateTime, Error>;
3219
3220 /// The `add()` method taking an ISO 8601 duration string and options; see
3221 /// [`ZonedDateTime::add_with_str`] for errors.
3222 #[wasm_bindgen(method, js_name = add, catch)]
3223 pub fn add_with_str_and_options(
3224 this: &ZonedDateTime,
3225 duration: &str,
3226 options: &OverflowOptions,
3227 ) -> Result<ZonedDateTime, RangeError>;
3228
3229 /// The `add()` method taking an ISO 8601 duration string.
3230 ///
3231 /// # Errors
3232 /// Throws a `RangeError` if the string is not a valid duration; see [`ZonedDateTime::add`] for the remaining errors.
3233 #[wasm_bindgen(method, js_name = add, catch)]
3234 pub fn add_with_str(this: &ZonedDateTime, duration: &str) -> Result<ZonedDateTime, RangeError>;
3235
3236 /// The `subtract()` method returns a new `Temporal.ZonedDateTime` object with the
3237 /// duration subtracted from this zoned date-time.
3238 ///
3239 /// # Errors
3240 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
3241 /// field would need constraining.
3242 ///
3243 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/subtract)
3244 #[wasm_bindgen(method, catch)]
3245 pub fn subtract(this: &ZonedDateTime, duration: &Duration)
3246 -> Result<ZonedDateTime, RangeError>;
3247
3248 /// The `subtract()` method returns a new `Temporal.ZonedDateTime` object with the
3249 /// duration subtracted from this zoned date-time.
3250 ///
3251 /// # Errors
3252 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
3253 /// field would need constraining.
3254 ///
3255 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/subtract)
3256 #[wasm_bindgen(method, js_name = subtract, catch)]
3257 pub fn subtract_with_options(
3258 this: &ZonedDateTime,
3259 duration: &Duration,
3260 options: &OverflowOptions,
3261 ) -> Result<ZonedDateTime, RangeError>;
3262
3263 /// The `subtract()` method taking a duration property bag.
3264 ///
3265 /// # Errors
3266 /// Throws a `TypeError` if no duration field is set; see [`ZonedDateTime::subtract`] for the remaining errors.
3267 #[wasm_bindgen(method, js_name = subtract, catch)]
3268 pub fn subtract_with_duration_like(
3269 this: &ZonedDateTime,
3270 duration: &DurationLike,
3271 ) -> Result<ZonedDateTime, Error>;
3272
3273 /// The `subtract()` method taking a duration property bag and options; see
3274 /// [`ZonedDateTime::subtract_with_duration_like`] for errors.
3275 #[wasm_bindgen(method, js_name = subtract, catch)]
3276 pub fn subtract_with_duration_like_and_options(
3277 this: &ZonedDateTime,
3278 duration: &DurationLike,
3279 options: &OverflowOptions,
3280 ) -> Result<ZonedDateTime, Error>;
3281
3282 /// The `subtract()` method taking an ISO 8601 duration string and options; see
3283 /// [`ZonedDateTime::subtract_with_str`] for errors.
3284 #[wasm_bindgen(method, js_name = subtract, catch)]
3285 pub fn subtract_with_str_and_options(
3286 this: &ZonedDateTime,
3287 duration: &str,
3288 options: &OverflowOptions,
3289 ) -> Result<ZonedDateTime, RangeError>;
3290
3291 /// The `subtract()` method taking an ISO 8601 duration string.
3292 ///
3293 /// # Errors
3294 /// Throws a `RangeError` if the string is not a valid duration; see [`ZonedDateTime::subtract`] for the remaining errors.
3295 #[wasm_bindgen(method, js_name = subtract, catch)]
3296 pub fn subtract_with_str(
3297 this: &ZonedDateTime,
3298 duration: &str,
3299 ) -> Result<ZonedDateTime, RangeError>;
3300
3301 /// The `until()` method returns a `Temporal.Duration` representing the duration
3302 /// from this zoned date-time until `other`.
3303 ///
3304 /// # Errors
3305 /// Throws a `RangeError` if dates have different time zones or calendars, or options are invalid.
3306 ///
3307 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/until)
3308 #[wasm_bindgen(method, catch)]
3309 pub fn until(this: &ZonedDateTime, other: &ZonedDateTime) -> Result<Duration, RangeError>;
3310
3311 /// The `until()` method returns a `Temporal.Duration` representing the duration
3312 /// from this zoned date-time until `other`.
3313 ///
3314 /// # Errors
3315 /// Throws a `RangeError` if dates have different time zones or calendars, or options are invalid.
3316 ///
3317 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/until)
3318 #[wasm_bindgen(method, js_name = until, catch)]
3319 pub fn until_with_options(
3320 this: &ZonedDateTime,
3321 other: &ZonedDateTime,
3322 options: &DifferenceOptions,
3323 ) -> Result<Duration, RangeError>;
3324
3325 /// The `since()` method returns a `Temporal.Duration` representing the duration
3326 /// from `other` until this zoned date-time.
3327 ///
3328 /// # Errors
3329 /// Throws a `RangeError` if dates have different time zones or calendars, or options are invalid.
3330 ///
3331 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/since)
3332 #[wasm_bindgen(method, catch)]
3333 pub fn since(this: &ZonedDateTime, other: &ZonedDateTime) -> Result<Duration, RangeError>;
3334
3335 /// The `until()` method taking a property bag; throws a `TypeError` if required fields are missing; see [`ZonedDateTime::until`] for the remaining errors.
3336 #[wasm_bindgen(method, js_name = until, catch)]
3337 pub fn until_with_zoned_date_time_like(
3338 this: &ZonedDateTime,
3339 other: &ZonedDateTimeLike,
3340 ) -> Result<Duration, Error>;
3341
3342 /// The `until()` method taking a property bag and options; throws a `TypeError` if required
3343 /// fields are missing. See [`ZonedDateTime::until_with_options`] for the remaining errors.
3344 #[wasm_bindgen(method, js_name = until, catch)]
3345 pub fn until_with_zoned_date_time_like_and_options(
3346 this: &ZonedDateTime,
3347 other: &ZonedDateTimeLike,
3348 options: &DifferenceOptions,
3349 ) -> Result<Duration, Error>;
3350
3351 /// The `until()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`ZonedDateTime::until`] for the remaining errors.
3352 #[wasm_bindgen(method, js_name = until, catch)]
3353 pub fn until_with_str(this: &ZonedDateTime, other: &str) -> Result<Duration, RangeError>;
3354
3355 /// The `until()` method taking an ISO 8601 string and options; see [`ZonedDateTime::until_with_options`]
3356 /// for errors.
3357 #[wasm_bindgen(method, js_name = until, catch)]
3358 pub fn until_with_str_and_options(
3359 this: &ZonedDateTime,
3360 other: &str,
3361 options: &DifferenceOptions,
3362 ) -> Result<Duration, RangeError>;
3363
3364 /// The `since()` method returns a `Temporal.Duration` representing the duration
3365 /// from `other` until this zoned date-time.
3366 ///
3367 /// # Errors
3368 /// Throws a `RangeError` if dates have different time zones or calendars, or options are invalid.
3369 ///
3370 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/since)
3371 #[wasm_bindgen(method, js_name = since, catch)]
3372 pub fn since_with_options(
3373 this: &ZonedDateTime,
3374 other: &ZonedDateTime,
3375 options: &DifferenceOptions,
3376 ) -> Result<Duration, RangeError>;
3377
3378 /// The `round()` method returns a new `Temporal.ZonedDateTime` object with the
3379 /// zoned date-time rounded to the given unit.
3380 ///
3381 /// # Errors
3382 /// Throws a `RangeError` if `smallestUnit` is not provided, specifies invalid units,
3383 /// or if `roundingIncrement` is invalid for the unit.
3384 ///
3385 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/round)
3386 ///
3387 #[wasm_bindgen(method, js_name = round, catch)]
3388 pub fn round(
3389 this: &ZonedDateTime,
3390 round_to: &RoundToOptions,
3391 ) -> Result<ZonedDateTime, RangeError>;
3392
3393 /// The `since()` method taking a property bag; throws a `TypeError` if required fields are missing; see [`ZonedDateTime::since`] for the remaining errors.
3394 #[wasm_bindgen(method, js_name = since, catch)]
3395 pub fn since_with_zoned_date_time_like(
3396 this: &ZonedDateTime,
3397 other: &ZonedDateTimeLike,
3398 ) -> Result<Duration, Error>;
3399
3400 /// The `since()` method taking a property bag and options; throws a `TypeError` if required
3401 /// fields are missing. See [`ZonedDateTime::since_with_options`] for the remaining errors.
3402 #[wasm_bindgen(method, js_name = since, catch)]
3403 pub fn since_with_zoned_date_time_like_and_options(
3404 this: &ZonedDateTime,
3405 other: &ZonedDateTimeLike,
3406 options: &DifferenceOptions,
3407 ) -> Result<Duration, Error>;
3408
3409 /// The `since()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`ZonedDateTime::since`] for the remaining errors.
3410 #[wasm_bindgen(method, js_name = since, catch)]
3411 pub fn since_with_str(this: &ZonedDateTime, other: &str) -> Result<Duration, RangeError>;
3412
3413 /// The `since()` method taking an ISO 8601 string and options; see [`ZonedDateTime::since_with_options`]
3414 /// for errors.
3415 #[wasm_bindgen(method, js_name = since, catch)]
3416 pub fn since_with_str_and_options(
3417 this: &ZonedDateTime,
3418 other: &str,
3419 options: &DifferenceOptions,
3420 ) -> Result<Duration, RangeError>;
3421
3422 /// Shorthand for `round()` with only `smallestUnit` set.
3423 #[wasm_bindgen(method, js_name = round, catch)]
3424 pub fn round_with_unit(
3425 this: &ZonedDateTime,
3426 smallest_unit: Unit,
3427 ) -> Result<ZonedDateTime, RangeError>;
3428
3429 /// The `startOfDay()` method returns a `Temporal.ZonedDateTime` object representing
3430 /// the start of the day (usually midnight) of this zoned date-time.
3431 ///
3432 /// # Errors
3433 /// Throws a `RangeError` if the start of the day falls outside the representable instant range.
3434 ///
3435 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/startOfDay)
3436 #[wasm_bindgen(method, js_name = startOfDay, catch)]
3437 pub fn start_of_day(this: &ZonedDateTime) -> Result<ZonedDateTime, RangeError>;
3438
3439 /// The `getTimeZoneTransition()` method returns a `Temporal.ZonedDateTime`
3440 /// representing the closest UTC offset transition in this time zone in the
3441 /// given direction, or `Nullable::Null` if there is none.
3442 ///
3443 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/getTimeZoneTransition)
3444 #[wasm_bindgen(method, js_name = getTimeZoneTransition)]
3445 pub fn get_time_zone_transition(
3446 this: &ZonedDateTime,
3447 options: &TimeZoneTransitionOptions,
3448 ) -> Nullable<ZonedDateTime>;
3449
3450 /// Shorthand for `getTimeZoneTransition()` with only `direction` set.
3451 #[wasm_bindgen(method, js_name = getTimeZoneTransition)]
3452 pub fn get_time_zone_transition_with_direction(
3453 this: &ZonedDateTime,
3454 direction: TransitionDirection,
3455 ) -> Nullable<ZonedDateTime>;
3456
3457 /// The `toInstant()` method returns a `Temporal.Instant` object representing the
3458 /// same instant as this zoned date-time.
3459 ///
3460 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toInstant)
3461 #[wasm_bindgen(method, js_name = toInstant)]
3462 pub fn to_instant(this: &ZonedDateTime) -> Instant;
3463
3464 /// The `toPlainDateTime()` method returns a `Temporal.PlainDateTime` object representing
3465 /// the date and time parts of this zoned date-time.
3466 ///
3467 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toPlainDateTime)
3468 #[wasm_bindgen(method, js_name = toPlainDateTime)]
3469 pub fn to_plain_date_time(this: &ZonedDateTime) -> PlainDateTime;
3470
3471 /// The `toPlainDate()` method returns a `Temporal.PlainDate` object representing
3472 /// the date part of this zoned date-time.
3473 ///
3474 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toPlainDate)
3475 #[wasm_bindgen(method, js_name = toPlainDate)]
3476 pub fn to_plain_date(this: &ZonedDateTime) -> PlainDate;
3477
3478 /// The `toPlainTime()` method returns a `Temporal.PlainTime` object representing
3479 /// the time part of this zoned date-time.
3480 ///
3481 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toPlainTime)
3482 #[wasm_bindgen(method, js_name = toPlainTime)]
3483 pub fn to_plain_time(this: &ZonedDateTime) -> PlainTime;
3484
3485 /// The `toLocaleString()` method returns a language-sensitive string representation
3486 /// of this zoned date-time.
3487 ///
3488 /// # Errors
3489 /// Throws a `RangeError` if `locales` is invalid or the locale's calendar does
3490 /// not match this value's calendar.
3491 ///
3492 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toLocaleString)
3493 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3494 pub fn to_locale_string(this: &ZonedDateTime) -> Result<JsString, RangeError>;
3495
3496 /// The `toLocaleString()` method; see [`ZonedDateTime::to_locale_string`] for errors.
3497 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3498 pub fn to_locale_string_with_str(
3499 this: &ZonedDateTime,
3500 locales: &str,
3501 ) -> Result<JsString, RangeError>;
3502
3503 /// The `toLocaleString()` method; see [`ZonedDateTime::to_locale_string`] for errors.
3504 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3505 pub fn to_locale_string_with_str_sequence(
3506 this: &ZonedDateTime,
3507 locales: &[JsString],
3508 ) -> Result<JsString, RangeError>;
3509
3510 /// The `toLocaleString()` method with options; throws a `TypeError` if an option does not
3511 /// apply to this type or conflicts with another. See [`ZonedDateTime::to_locale_string`] for the
3512 /// remaining errors.
3513 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3514 pub fn to_locale_string_with_str_sequence_and_options(
3515 this: &ZonedDateTime,
3516 locales: &[JsString],
3517 options: &Intl::DateTimeFormatOptions,
3518 ) -> Result<JsString, Error>;
3519
3520 /// The `toLocaleString()` method with options; `None` for `locales` uses the default locale.
3521 /// Throws a `TypeError` if an option does not apply to this type or conflicts with another.
3522 /// See [`ZonedDateTime::to_locale_string`] for the remaining errors.
3523 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3524 pub fn to_locale_string_with_options(
3525 this: &ZonedDateTime,
3526 locales: Option<&str>,
3527 options: &Intl::DateTimeFormatOptions,
3528 ) -> Result<JsString, Error>;
3529
3530 /// The `toJSON()` method returns a string representation of this zoned date-time
3531 /// suitable for JSON serialization.
3532 ///
3533 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toJSON)
3534 #[wasm_bindgen(method, js_name = toJSON)]
3535 pub fn to_json(this: &ZonedDateTime) -> JsString;
3536
3537 /// The `toString()` method returns an RFC 9557 string representation of this date-time.
3538 ///
3539 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toString)
3540 #[wasm_bindgen(method, js_name = toString)]
3541 pub fn to_js_string(this: &ZonedDateTime) -> JsString;
3542
3543 /// The `toString()` method returns an RFC 9557 string representation of this date-time,
3544 /// formatted according to `options`.
3545 ///
3546 /// # Errors
3547 /// Throws a `RangeError` if the options are invalid for this type.
3548 ///
3549 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/toString)
3550 #[wasm_bindgen(method, js_name = toString, catch)]
3551 pub fn to_js_string_with_options(
3552 this: &ZonedDateTime,
3553 options: &ZonedDateTimeToStringOptions,
3554 ) -> Result<JsString, RangeError>;
3555}
3556
3557#[wasm_bindgen]
3558extern "C" {
3559 /// A `Temporal.Duration` represents an immutable duration of time which can be
3560 /// used in date/time arithmetic.
3561 ///
3562 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration)
3563 #[wasm_bindgen(js_namespace = Temporal, extends = Object)]
3564 #[derive(Clone, Debug)]
3565 pub type Duration;
3566
3567 /// The `Temporal.Duration()` constructor creates `Temporal.Duration` objects.
3568 /// Omitted fields default to zero, so this form is the blank duration `PT0S`.
3569 ///
3570 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/Duration)
3571 #[wasm_bindgen(constructor, js_namespace = Temporal)]
3572 pub fn new() -> Duration;
3573
3574 /// The `Temporal.Duration()` constructor with the leading fields set.
3575 ///
3576 /// # Errors
3577 /// Throws a `RangeError` if any field is non-integer, infinite, exceeds the
3578 /// safe integer range, or if fields have mixed signs.
3579 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3580 pub fn new_with_years(years: f64) -> Result<Duration, RangeError>;
3581
3582 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3583 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3584 pub fn new_with_years_and_months(years: f64, months: f64) -> Result<Duration, RangeError>;
3585
3586 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3587 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3588 pub fn new_with_years_and_months_and_weeks(
3589 years: f64,
3590 months: f64,
3591 weeks: f64,
3592 ) -> Result<Duration, RangeError>;
3593
3594 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3595 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3596 pub fn new_with_years_and_months_and_weeks_and_days(
3597 years: f64,
3598 months: f64,
3599 weeks: f64,
3600 days: f64,
3601 ) -> Result<Duration, RangeError>;
3602
3603 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3604 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3605 pub fn new_with_years_and_months_and_weeks_and_days_and_hours(
3606 years: f64,
3607 months: f64,
3608 weeks: f64,
3609 days: f64,
3610 hours: f64,
3611 ) -> Result<Duration, RangeError>;
3612
3613 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3614 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3615 pub fn new_with_years_and_months_and_weeks_and_days_and_hours_and_minutes(
3616 years: f64,
3617 months: f64,
3618 weeks: f64,
3619 days: f64,
3620 hours: f64,
3621 minutes: f64,
3622 ) -> Result<Duration, RangeError>;
3623
3624 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3625 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3626 pub fn new_with_years_and_months_and_weeks_and_days_and_hours_and_minutes_and_seconds(
3627 years: f64,
3628 months: f64,
3629 weeks: f64,
3630 days: f64,
3631 hours: f64,
3632 minutes: f64,
3633 seconds: f64,
3634 ) -> Result<Duration, RangeError>;
3635
3636 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3637 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3638 pub fn new_with_years_and_months_and_weeks_and_days_and_hours_and_minutes_and_seconds_and_milliseconds(
3639 years: f64,
3640 months: f64,
3641 weeks: f64,
3642 days: f64,
3643 hours: f64,
3644 minutes: f64,
3645 seconds: f64,
3646 milliseconds: f64,
3647 ) -> Result<Duration, RangeError>;
3648
3649 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3650 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3651 pub fn new_with_years_and_months_and_weeks_and_days_and_hours_and_minutes_and_seconds_and_milliseconds_and_microseconds(
3652 years: f64,
3653 months: f64,
3654 weeks: f64,
3655 days: f64,
3656 hours: f64,
3657 minutes: f64,
3658 seconds: f64,
3659 milliseconds: f64,
3660 microseconds: f64,
3661 ) -> Result<Duration, RangeError>;
3662
3663 /// The `Temporal.Duration()` constructor; see [`Duration::new_with_years`] for errors.
3664 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
3665 pub fn new_with_years_and_months_and_weeks_and_days_and_hours_and_minutes_and_seconds_and_milliseconds_and_microseconds_and_nanoseconds(
3666 years: f64,
3667 months: f64,
3668 weeks: f64,
3669 days: f64,
3670 hours: f64,
3671 minutes: f64,
3672 seconds: f64,
3673 milliseconds: f64,
3674 microseconds: f64,
3675 nanoseconds: f64,
3676 ) -> Result<Duration, RangeError>;
3677
3678 /// The `Temporal.Duration.from()` static method creates a new `Temporal.Duration`
3679 /// object from another Duration, an object with duration properties, or an ISO 8601 string.
3680 ///
3681 /// # Errors
3682 /// Throws a `RangeError` if the string is not a valid ISO 8601 duration format,
3683 /// or if any numeric values are invalid.
3684 ///
3685 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/from)
3686 #[wasm_bindgen(static_method_of = Duration, js_namespace = Temporal, js_name = from, catch)]
3687 pub fn from_with_str(item: &str) -> Result<Duration, RangeError>;
3688
3689 /// The `Temporal.Duration.from()` static method taking a property bag; throws a `TypeError` if
3690 /// required fields are missing. See [`Duration::from_with_str`] for the remaining errors.
3691 #[wasm_bindgen(static_method_of = Duration, js_namespace = Temporal, js_name = from, catch)]
3692 pub fn from_with_duration_like(item: &DurationLike) -> Result<Duration, Error>;
3693
3694 /// The `Temporal.Duration.from()` static method.
3695 #[wasm_bindgen(static_method_of = Duration, js_namespace = Temporal, js_name = from)]
3696 pub fn from_with_duration(item: &Duration) -> Duration;
3697
3698 /// The `Temporal.Duration.compare()` static method returns -1, 0, or 1 depending
3699 /// on whether `one` is shorter than, equal to, or longer than `two`.
3700 ///
3701 /// # Errors
3702 /// Throws a `RangeError` if `relativeTo` is required (when either duration has
3703 /// calendar units like years, months, or weeks) but not provided.
3704 ///
3705 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/compare)
3706 #[wasm_bindgen(static_method_of = Duration, js_namespace = Temporal, catch)]
3707 pub fn compare(one: &Duration, two: &Duration) -> Result<i32, RangeError>;
3708
3709 /// The `Temporal.Duration.compare()` static method returns -1, 0, or 1 depending
3710 /// on whether `one` is shorter than, equal to, or longer than `two`.
3711 ///
3712 /// # Errors
3713 /// Throws a `RangeError` if `relativeTo` is required (when either duration has
3714 /// calendar units like years, months, or weeks) but not provided.
3715 /// Throws a `TypeError` if `relativeTo` is a property bag missing required fields.
3716 ///
3717 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/compare)
3718 #[wasm_bindgen(static_method_of = Duration, js_namespace = Temporal, js_name = compare, catch)]
3719 pub fn compare_with_options(
3720 one: &Duration,
3721 two: &Duration,
3722 options: &RelativeToOptions,
3723 ) -> Result<i32, Error>;
3724
3725 /// The `sign` accessor property returns -1, 0, or 1 depending on whether
3726 /// the duration is negative, zero, or positive.
3727 ///
3728 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/sign)
3729 #[wasm_bindgen(method, getter)]
3730 pub fn sign(this: &Duration) -> i32;
3731
3732 /// The `blank` accessor property returns `true` if the duration represents
3733 /// zero length of time, and `false` otherwise.
3734 ///
3735 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/blank)
3736 #[wasm_bindgen(method, getter)]
3737 pub fn blank(this: &Duration) -> bool;
3738
3739 /// The `years` accessor property returns the number of years in the duration.
3740 ///
3741 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/years)
3742 #[wasm_bindgen(method, getter)]
3743 pub fn years(this: &Duration) -> f64;
3744
3745 /// The `months` accessor property returns the number of months in the duration.
3746 ///
3747 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/months)
3748 #[wasm_bindgen(method, getter)]
3749 pub fn months(this: &Duration) -> f64;
3750
3751 /// The `weeks` accessor property returns the number of weeks in the duration.
3752 ///
3753 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/weeks)
3754 #[wasm_bindgen(method, getter)]
3755 pub fn weeks(this: &Duration) -> f64;
3756
3757 /// The `days` accessor property returns the number of days in the duration.
3758 ///
3759 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/days)
3760 #[wasm_bindgen(method, getter)]
3761 pub fn days(this: &Duration) -> f64;
3762
3763 /// The `hours` accessor property returns the number of hours in the duration.
3764 ///
3765 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/hours)
3766 #[wasm_bindgen(method, getter)]
3767 pub fn hours(this: &Duration) -> f64;
3768
3769 /// The `minutes` accessor property returns the number of minutes in the duration.
3770 ///
3771 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/minutes)
3772 #[wasm_bindgen(method, getter)]
3773 pub fn minutes(this: &Duration) -> f64;
3774
3775 /// The `seconds` accessor property returns the number of seconds in the duration.
3776 ///
3777 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/seconds)
3778 #[wasm_bindgen(method, getter)]
3779 pub fn seconds(this: &Duration) -> f64;
3780
3781 /// The `milliseconds` accessor property returns the number of milliseconds in the duration.
3782 ///
3783 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/milliseconds)
3784 #[wasm_bindgen(method, getter)]
3785 pub fn milliseconds(this: &Duration) -> f64;
3786
3787 /// The `microseconds` accessor property returns the number of microseconds in the duration.
3788 ///
3789 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/microseconds)
3790 #[wasm_bindgen(method, getter)]
3791 pub fn microseconds(this: &Duration) -> f64;
3792
3793 /// The `nanoseconds` accessor property returns the number of nanoseconds in the duration.
3794 ///
3795 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/nanoseconds)
3796 #[wasm_bindgen(method, getter)]
3797 pub fn nanoseconds(this: &Duration) -> f64;
3798
3799 /// The `negated()` method returns a new `Temporal.Duration` object with the
3800 /// opposite sign (positive becomes negative and vice versa).
3801 ///
3802 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/negated)
3803 #[wasm_bindgen(method)]
3804 pub fn negated(this: &Duration) -> Duration;
3805
3806 /// The `abs()` method returns a new `Temporal.Duration` object with the
3807 /// absolute value of the duration (all negative values become positive).
3808 ///
3809 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/abs)
3810 #[wasm_bindgen(method)]
3811 pub fn abs(this: &Duration) -> Duration;
3812
3813 /// The `with()` method returns a new `Temporal.Duration` object with some
3814 /// fields replaced by new values.
3815 ///
3816 /// # Errors
3817 /// Throws a `TypeError` if no duration field is set, and a `RangeError` if any value is
3818 /// invalid or the result has mixed signs.
3819 ///
3820 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/with)
3821 #[wasm_bindgen(method, catch)]
3822 pub fn with(this: &Duration, fields: &DurationLike) -> Result<Duration, Error>;
3823
3824 /// The `add()` method returns a new `Temporal.Duration` object with the
3825 /// sum of this duration and another duration.
3826 ///
3827 /// # Errors
3828 /// Throws a `RangeError` if either duration has nonzero years, months or weeks,
3829 /// or if the result would exceed the valid range.
3830 ///
3831 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/add)
3832 #[wasm_bindgen(method, catch)]
3833 pub fn add(this: &Duration, other: &Duration) -> Result<Duration, RangeError>;
3834
3835 /// The `subtract()` method returns a new `Temporal.Duration` object with the
3836 /// difference of this duration and another duration.
3837 ///
3838 /// # Errors
3839 /// Throws a `RangeError` if either duration has nonzero years, months or weeks,
3840 /// or if the result would exceed the valid range.
3841 ///
3842 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/subtract)
3843 #[wasm_bindgen(method, catch)]
3844 pub fn subtract(this: &Duration, other: &Duration) -> Result<Duration, RangeError>;
3845
3846 /// The `add()` method taking a duration property bag.
3847 ///
3848 /// # Errors
3849 /// Throws a `TypeError` if no duration field is set; see [`Duration::add`] for the remaining errors.
3850 #[wasm_bindgen(method, js_name = add, catch)]
3851 pub fn add_with_duration_like(this: &Duration, other: &DurationLike)
3852 -> Result<Duration, Error>;
3853
3854 /// The `subtract()` method taking a duration property bag.
3855 ///
3856 /// # Errors
3857 /// Throws a `TypeError` if no duration field is set; see [`Duration::subtract`] for the remaining errors.
3858 #[wasm_bindgen(method, js_name = subtract, catch)]
3859 pub fn subtract_with_duration_like(
3860 this: &Duration,
3861 other: &DurationLike,
3862 ) -> Result<Duration, Error>;
3863
3864 /// The `subtract()` method taking an ISO 8601 duration string.
3865 ///
3866 /// # Errors
3867 /// Throws a `RangeError` if the string is not a valid duration; see [`Duration::subtract`] for the remaining errors.
3868 #[wasm_bindgen(method, js_name = subtract, catch)]
3869 pub fn subtract_with_str(this: &Duration, other: &str) -> Result<Duration, RangeError>;
3870
3871 /// The `add()` method taking an ISO 8601 duration string.
3872 ///
3873 /// # Errors
3874 /// Throws a `RangeError` if the string is not a valid duration; see [`Duration::add`] for the remaining errors.
3875 #[wasm_bindgen(method, js_name = add, catch)]
3876 pub fn add_with_str(this: &Duration, other: &str) -> Result<Duration, RangeError>;
3877
3878 /// The `round()` method returns a new `Temporal.Duration` object with the
3879 /// duration rounded and/or balanced to the given options.
3880 ///
3881 /// # Errors
3882 /// Throws a `RangeError` if neither `smallestUnit` nor `largestUnit` is provided,
3883 /// if `relativeTo` is required for calendar units but not provided, or if options
3884 /// are invalid.
3885 /// Throws a `TypeError` if `relativeTo` is a property bag missing required fields.
3886 ///
3887 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/round)
3888 #[wasm_bindgen(method, js_name = round, catch)]
3889 pub fn round(this: &Duration, round_to: &DurationRoundToOptions) -> Result<Duration, Error>;
3890
3891 /// Shorthand for `round()` with only `smallestUnit` set.
3892 #[wasm_bindgen(method, js_name = round, catch)]
3893 pub fn round_with_unit(this: &Duration, smallest_unit: Unit) -> Result<Duration, RangeError>;
3894
3895 /// The `total()` method returns the total number of the specified unit that
3896 /// fits in the duration as a floating point number.
3897 ///
3898 /// # Errors
3899 /// Throws a `RangeError` if `unit` is not provided, or if `relativeTo` is required
3900 /// for calendar units (years, months, weeks) but not provided.
3901 /// Throws a `TypeError` if `relativeTo` is a property bag missing required fields.
3902 ///
3903 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/total)
3904 #[wasm_bindgen(method, js_name = total, catch)]
3905 pub fn total(this: &Duration, total_of: &DurationTotalOptions) -> Result<f64, Error>;
3906
3907 /// Shorthand for `total()` with only `unit` set.
3908 #[wasm_bindgen(method, js_name = total, catch)]
3909 pub fn total_with_unit(this: &Duration, unit: Unit) -> Result<f64, RangeError>;
3910
3911 /// The `toLocaleString()` method returns a language-sensitive string representation
3912 /// of this duration.
3913 ///
3914 /// `options` are `Intl.DurationFormat` options.
3915 ///
3916 /// # Errors
3917 /// Throws a `RangeError` if `locales` is invalid.
3918 ///
3919 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/toLocaleString)
3920 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3921 pub fn to_locale_string(this: &Duration) -> Result<JsString, RangeError>;
3922
3923 /// The `toLocaleString()` method; see [`Duration::to_locale_string`] for errors.
3924 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3925 pub fn to_locale_string_with_str(
3926 this: &Duration,
3927 locales: &str,
3928 ) -> Result<JsString, RangeError>;
3929
3930 /// The `toLocaleString()` method; see [`Duration::to_locale_string`] for errors.
3931 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3932 pub fn to_locale_string_with_str_sequence(
3933 this: &Duration,
3934 locales: &[JsString],
3935 ) -> Result<JsString, RangeError>;
3936
3937 /// The `toLocaleString()` method with options; throws a `TypeError` if an option does not
3938 /// apply to this type or conflicts with another. See [`Duration::to_locale_string`] for the
3939 /// remaining errors.
3940 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3941 pub fn to_locale_string_with_str_sequence_and_options(
3942 this: &Duration,
3943 locales: &[JsString],
3944 options: &Intl::DurationFormatOptions,
3945 ) -> Result<JsString, Error>;
3946
3947 /// The `toLocaleString()` method with options; `None` for `locales` uses the default locale.
3948 /// Throws a `TypeError` if an option does not apply to this type or conflicts with another.
3949 /// See [`Duration::to_locale_string`] for the remaining errors.
3950 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
3951 pub fn to_locale_string_with_options(
3952 this: &Duration,
3953 locales: Option<&str>,
3954 options: &Intl::DurationFormatOptions,
3955 ) -> Result<JsString, Error>;
3956
3957 /// The `toJSON()` method returns a string representation of this duration
3958 /// suitable for JSON serialization (same as `toString()`).
3959 ///
3960 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/toJSON)
3961 #[wasm_bindgen(method, js_name = toJSON)]
3962 pub fn to_json(this: &Duration) -> JsString;
3963
3964 /// The `toString()` method returns an ISO 8601 duration string representation of this duration.
3965 ///
3966 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/toString)
3967 #[wasm_bindgen(method, js_name = toString)]
3968 pub fn to_js_string(this: &Duration) -> JsString;
3969
3970 /// The `toString()` method returns an ISO 8601 duration string representation of this duration,
3971 /// formatted according to `options`.
3972 ///
3973 /// # Errors
3974 /// Throws a `RangeError` if the options are invalid for this type.
3975 ///
3976 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/toString)
3977 #[wasm_bindgen(method, js_name = toString, catch)]
3978 pub fn to_js_string_with_options(
3979 this: &Duration,
3980 options: &ToStringPrecisionOptions,
3981 ) -> Result<JsString, RangeError>;
3982}
3983
3984#[wasm_bindgen]
3985extern "C" {
3986 /// A `Temporal.PlainTime` represents a wall-clock time, with a precision in
3987 /// nanoseconds, and without any time zone or calendar information.
3988 ///
3989 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime)
3990 #[wasm_bindgen(js_namespace = Temporal, extends = Object)]
3991 #[derive(Clone, Debug)]
3992 pub type PlainTime;
3993
3994 /// The `Temporal.PlainTime()` constructor creates `Temporal.PlainTime` objects.
3995 /// Omitted fields default to zero, so this form is midnight.
3996 ///
3997 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/PlainTime)
3998 #[wasm_bindgen(constructor, js_namespace = Temporal)]
3999 pub fn new() -> PlainTime;
4000
4001 /// The `Temporal.PlainTime()` constructor with the leading fields set.
4002 ///
4003 /// # Errors
4004 /// Throws a `RangeError` if any field is out of range.
4005 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4006 pub fn new_with_hour(hour: u32) -> Result<PlainTime, RangeError>;
4007
4008 /// The `Temporal.PlainTime()` constructor; see [`PlainTime::new_with_hour`] for errors.
4009 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4010 pub fn new_with_hour_and_minute(hour: u32, minute: u32) -> Result<PlainTime, RangeError>;
4011
4012 /// The `Temporal.PlainTime()` constructor; see [`PlainTime::new_with_hour`] for errors.
4013 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4014 pub fn new_with_hour_and_minute_and_second(
4015 hour: u32,
4016 minute: u32,
4017 second: u32,
4018 ) -> Result<PlainTime, RangeError>;
4019
4020 /// The `Temporal.PlainTime()` constructor; see [`PlainTime::new_with_hour`] for errors.
4021 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4022 pub fn new_with_hour_and_minute_and_second_and_millisecond(
4023 hour: u32,
4024 minute: u32,
4025 second: u32,
4026 millisecond: u32,
4027 ) -> Result<PlainTime, RangeError>;
4028
4029 /// The `Temporal.PlainTime()` constructor; see [`PlainTime::new_with_hour`] for errors.
4030 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4031 pub fn new_with_hour_and_minute_and_second_and_millisecond_and_microsecond(
4032 hour: u32,
4033 minute: u32,
4034 second: u32,
4035 millisecond: u32,
4036 microsecond: u32,
4037 ) -> Result<PlainTime, RangeError>;
4038
4039 /// The `Temporal.PlainTime()` constructor; see [`PlainTime::new_with_hour`] for errors.
4040 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4041 pub fn new_with_hour_and_minute_and_second_and_millisecond_and_microsecond_and_nanosecond(
4042 hour: u32,
4043 minute: u32,
4044 second: u32,
4045 millisecond: u32,
4046 microsecond: u32,
4047 nanosecond: u32,
4048 ) -> Result<PlainTime, RangeError>;
4049
4050 /// The `Temporal.PlainTime.from()` static method creates a new `Temporal.PlainTime`
4051 /// object from another value.
4052 ///
4053 /// # Errors
4054 /// Throws a `RangeError` if the string is invalid or values are out of range
4055 /// (when `overflow` is `'reject'`).
4056 ///
4057 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/from)
4058 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from, catch)]
4059 pub fn from_with_str(item: &str) -> Result<PlainTime, RangeError>;
4060
4061 /// The `Temporal.PlainTime.from()` static method; see [`PlainTime::from_with_str`] for errors.
4062 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from, catch)]
4063 pub fn from_with_str_and_options(
4064 item: &str,
4065 options: &OverflowOptions,
4066 ) -> Result<PlainTime, RangeError>;
4067
4068 /// The `Temporal.PlainTime.from()` static method taking a property bag; throws a `TypeError` if
4069 /// required fields are missing. See [`PlainTime::from_with_str`] for the remaining errors.
4070 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from, catch)]
4071 pub fn from_with_plain_time_like(item: &PlainTimeLike) -> Result<PlainTime, Error>;
4072
4073 /// The `Temporal.PlainTime.from()` static method taking a property bag; throws a `TypeError` if
4074 /// required fields are missing. See [`PlainTime::from_with_str`] for the remaining errors.
4075 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from, catch)]
4076 pub fn from_with_plain_time_like_and_options(
4077 item: &PlainTimeLike,
4078 options: &OverflowOptions,
4079 ) -> Result<PlainTime, Error>;
4080
4081 /// The `Temporal.PlainTime.from()` static method.
4082 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from)]
4083 pub fn from_with_plain_time(item: &PlainTime) -> PlainTime;
4084
4085 /// The `Temporal.PlainTime.from()` static method.
4086 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from)]
4087 pub fn from_with_plain_time_and_options(
4088 item: &PlainTime,
4089 options: &OverflowOptions,
4090 ) -> PlainTime;
4091
4092 /// The `Temporal.PlainTime.from()` static method.
4093 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from)]
4094 pub fn from_with_plain_date_time(item: &PlainDateTime) -> PlainTime;
4095
4096 /// The `Temporal.PlainTime.from()` static method.
4097 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from)]
4098 pub fn from_with_plain_date_time_and_options(
4099 item: &PlainDateTime,
4100 options: &OverflowOptions,
4101 ) -> PlainTime;
4102
4103 /// The `Temporal.PlainTime.from()` static method.
4104 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from)]
4105 pub fn from_with_zoned_date_time(item: &ZonedDateTime) -> PlainTime;
4106
4107 /// The `Temporal.PlainTime.from()` static method.
4108 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal, js_name = from)]
4109 pub fn from_with_zoned_date_time_and_options(
4110 item: &ZonedDateTime,
4111 options: &OverflowOptions,
4112 ) -> PlainTime;
4113
4114 /// The `Temporal.PlainTime.compare()` static method returns -1, 0, or 1 depending
4115 /// on whether `one` comes before, is equal to, or comes after `two`.
4116 ///
4117 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/compare)
4118 #[wasm_bindgen(static_method_of = PlainTime, js_namespace = Temporal)]
4119 pub fn compare(one: &PlainTime, two: &PlainTime) -> i32;
4120
4121 /// The `hour` accessor property returns an integer from 0 to 23 representing
4122 /// the hour component of this time.
4123 ///
4124 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/hour)
4125 #[wasm_bindgen(method, getter)]
4126 pub fn hour(this: &PlainTime) -> u32;
4127
4128 /// The `minute` accessor property returns an integer from 0 to 59 representing
4129 /// the minute component of this time.
4130 ///
4131 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/minute)
4132 #[wasm_bindgen(method, getter)]
4133 pub fn minute(this: &PlainTime) -> u32;
4134
4135 /// The `second` accessor property returns an integer from 0 to 59 representing
4136 /// the second component of this time.
4137 ///
4138 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/second)
4139 #[wasm_bindgen(method, getter)]
4140 pub fn second(this: &PlainTime) -> u32;
4141
4142 /// The `millisecond` accessor property returns an integer from 0 to 999 representing
4143 /// the millisecond component of this time.
4144 ///
4145 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/millisecond)
4146 #[wasm_bindgen(method, getter)]
4147 pub fn millisecond(this: &PlainTime) -> u32;
4148
4149 /// The `microsecond` accessor property returns an integer from 0 to 999 representing
4150 /// the microsecond component of this time.
4151 ///
4152 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/microsecond)
4153 #[wasm_bindgen(method, getter)]
4154 pub fn microsecond(this: &PlainTime) -> u32;
4155
4156 /// The `nanosecond` accessor property returns an integer from 0 to 999 representing
4157 /// the nanosecond component of this time.
4158 ///
4159 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/nanosecond)
4160 #[wasm_bindgen(method, getter)]
4161 pub fn nanosecond(this: &PlainTime) -> u32;
4162
4163 /// The `equals()` method returns `true` if this time is equal to `other`.
4164 ///
4165 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/equals)
4166 #[wasm_bindgen(method)]
4167 pub fn equals(this: &PlainTime, other: &PlainTime) -> bool;
4168
4169 /// The `with()` method returns a new `Temporal.PlainTime` object with some
4170 /// fields replaced by new values.
4171 ///
4172 /// # Errors
4173 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
4174 /// of range or `overflow` is `'reject'` and a field would need constraining.
4175 ///
4176 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/with)
4177 #[wasm_bindgen(method, catch)]
4178 pub fn with(this: &PlainTime, fields: &PlainTimeLike) -> Result<PlainTime, Error>;
4179
4180 /// The `equals()` method taking a `Temporal.PlainDateTime`.
4181 #[wasm_bindgen(method, js_name = equals)]
4182 pub fn equals_with_plain_date_time(this: &PlainTime, other: &PlainDateTime) -> bool;
4183
4184 /// The `equals()` method taking a `Temporal.ZonedDateTime`.
4185 #[wasm_bindgen(method, js_name = equals)]
4186 pub fn equals_with_zoned_date_time(this: &PlainTime, other: &ZonedDateTime) -> bool;
4187
4188 /// The `equals()` method taking a property bag; throws a `TypeError` if required fields are missing.
4189 #[wasm_bindgen(method, js_name = equals, catch)]
4190 pub fn equals_with_plain_time_like(
4191 this: &PlainTime,
4192 other: &PlainTimeLike,
4193 ) -> Result<bool, Error>;
4194
4195 /// The `equals()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
4196 #[wasm_bindgen(method, js_name = equals, catch)]
4197 pub fn equals_with_str(this: &PlainTime, other: &str) -> Result<bool, RangeError>;
4198
4199 /// The `with()` method returns a new `Temporal.PlainTime` object with some
4200 /// fields replaced by new values.
4201 ///
4202 /// # Errors
4203 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
4204 /// of range or `overflow` is `'reject'` and a field would need constraining.
4205 ///
4206 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/with)
4207 #[wasm_bindgen(method, js_name = with, catch)]
4208 pub fn with_with_options(
4209 this: &PlainTime,
4210 fields: &PlainTimeLike,
4211 options: &OverflowOptions,
4212 ) -> Result<PlainTime, Error>;
4213
4214 /// The `add()` method returns a new `Temporal.PlainTime` object with the
4215 /// duration added to this time (wrapping around midnight if necessary).
4216 ///
4217 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/add)
4218 #[wasm_bindgen(method)]
4219 pub fn add(this: &PlainTime, duration: &Duration) -> PlainTime;
4220
4221 /// The `subtract()` method returns a new `Temporal.PlainTime` object with the
4222 /// duration subtracted from this time (wrapping around midnight if necessary).
4223 ///
4224 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/subtract)
4225 #[wasm_bindgen(method)]
4226 pub fn subtract(this: &PlainTime, duration: &Duration) -> PlainTime;
4227
4228 /// The `add()` method taking a duration property bag.
4229 ///
4230 /// # Errors
4231 /// Throws a `TypeError` if no duration field is set; otherwise infallible.
4232 #[wasm_bindgen(method, js_name = add, catch)]
4233 pub fn add_with_duration_like(
4234 this: &PlainTime,
4235 duration: &DurationLike,
4236 ) -> Result<PlainTime, Error>;
4237
4238 /// The `subtract()` method taking a duration property bag.
4239 ///
4240 /// # Errors
4241 /// Throws a `TypeError` if no duration field is set; otherwise infallible.
4242 #[wasm_bindgen(method, js_name = subtract, catch)]
4243 pub fn subtract_with_duration_like(
4244 this: &PlainTime,
4245 duration: &DurationLike,
4246 ) -> Result<PlainTime, Error>;
4247
4248 /// The `subtract()` method taking an ISO 8601 duration string.
4249 ///
4250 /// # Errors
4251 /// Throws a `RangeError` if the string is not a valid duration; otherwise infallible.
4252 #[wasm_bindgen(method, js_name = subtract, catch)]
4253 pub fn subtract_with_str(this: &PlainTime, duration: &str) -> Result<PlainTime, RangeError>;
4254
4255 /// The `add()` method taking an ISO 8601 duration string.
4256 ///
4257 /// # Errors
4258 /// Throws a `RangeError` if the string is not a valid duration; otherwise infallible.
4259 #[wasm_bindgen(method, js_name = add, catch)]
4260 pub fn add_with_str(this: &PlainTime, duration: &str) -> Result<PlainTime, RangeError>;
4261
4262 /// The `until()` method returns a `Temporal.Duration` representing the duration
4263 /// from this time until `other`.
4264 ///
4265 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/until)
4266 #[wasm_bindgen(method)]
4267 pub fn until(this: &PlainTime, other: &PlainTime) -> Duration;
4268
4269 /// The `until()` method returns a `Temporal.Duration` representing the duration
4270 /// from this time until `other`.
4271 ///
4272 /// # Errors
4273 /// Throws a `RangeError` if options specify calendar units or are otherwise invalid.
4274 ///
4275 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/until)
4276 #[wasm_bindgen(method, js_name = until, catch)]
4277 pub fn until_with_options(
4278 this: &PlainTime,
4279 other: &PlainTime,
4280 options: &DifferenceOptions,
4281 ) -> Result<Duration, RangeError>;
4282
4283 /// The `since()` method returns a `Temporal.Duration` representing the duration
4284 /// from `other` until this time.
4285 ///
4286 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/since)
4287 #[wasm_bindgen(method)]
4288 pub fn since(this: &PlainTime, other: &PlainTime) -> Duration;
4289
4290 /// The `until()` method taking a `Temporal.PlainDateTime`.
4291 #[wasm_bindgen(method, js_name = until)]
4292 pub fn until_with_plain_date_time(this: &PlainTime, other: &PlainDateTime) -> Duration;
4293
4294 /// The `until()` method taking a `Temporal.PlainDateTime` and options; see [`PlainTime::until_with_options`]
4295 /// for errors.
4296 #[wasm_bindgen(method, js_name = until, catch)]
4297 pub fn until_with_plain_date_time_and_options(
4298 this: &PlainTime,
4299 other: &PlainDateTime,
4300 options: &DifferenceOptions,
4301 ) -> Result<Duration, RangeError>;
4302
4303 /// The `until()` method taking a `Temporal.ZonedDateTime`.
4304 #[wasm_bindgen(method, js_name = until)]
4305 pub fn until_with_zoned_date_time(this: &PlainTime, other: &ZonedDateTime) -> Duration;
4306
4307 /// The `until()` method taking a `Temporal.ZonedDateTime` and options; see [`PlainTime::until_with_options`]
4308 /// for errors.
4309 #[wasm_bindgen(method, js_name = until, catch)]
4310 pub fn until_with_zoned_date_time_and_options(
4311 this: &PlainTime,
4312 other: &ZonedDateTime,
4313 options: &DifferenceOptions,
4314 ) -> Result<Duration, RangeError>;
4315
4316 /// The `until()` method taking a property bag; throws a `TypeError` if required fields are missing.
4317 #[wasm_bindgen(method, js_name = until, catch)]
4318 pub fn until_with_plain_time_like(
4319 this: &PlainTime,
4320 other: &PlainTimeLike,
4321 ) -> Result<Duration, Error>;
4322
4323 /// The `until()` method taking a property bag and options; throws a `TypeError` if required
4324 /// fields are missing. See [`PlainTime::until_with_options`] for the remaining errors.
4325 #[wasm_bindgen(method, js_name = until, catch)]
4326 pub fn until_with_plain_time_like_and_options(
4327 this: &PlainTime,
4328 other: &PlainTimeLike,
4329 options: &DifferenceOptions,
4330 ) -> Result<Duration, Error>;
4331
4332 /// The `until()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
4333 #[wasm_bindgen(method, js_name = until, catch)]
4334 pub fn until_with_str(this: &PlainTime, other: &str) -> Result<Duration, RangeError>;
4335
4336 /// The `until()` method taking an ISO 8601 string and options; see [`PlainTime::until_with_options`]
4337 /// for errors.
4338 #[wasm_bindgen(method, js_name = until, catch)]
4339 pub fn until_with_str_and_options(
4340 this: &PlainTime,
4341 other: &str,
4342 options: &DifferenceOptions,
4343 ) -> Result<Duration, RangeError>;
4344
4345 /// The `since()` method returns a `Temporal.Duration` representing the duration
4346 /// from `other` until this time.
4347 ///
4348 /// # Errors
4349 /// Throws a `RangeError` if options specify calendar units or are otherwise invalid.
4350 ///
4351 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/since)
4352 #[wasm_bindgen(method, js_name = since, catch)]
4353 pub fn since_with_options(
4354 this: &PlainTime,
4355 other: &PlainTime,
4356 options: &DifferenceOptions,
4357 ) -> Result<Duration, RangeError>;
4358
4359 /// The `round()` method returns a new `Temporal.PlainTime` object with the
4360 /// time rounded to the given unit.
4361 ///
4362 /// # Errors
4363 /// Throws a `RangeError` if `smallestUnit` is not provided or specifies calendar units,
4364 /// or if `roundingIncrement` is invalid for the unit.
4365 ///
4366 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/round)
4367 #[wasm_bindgen(method, js_name = round, catch)]
4368 pub fn round(this: &PlainTime, round_to: &RoundToOptions) -> Result<PlainTime, RangeError>;
4369
4370 /// The `since()` method taking a `Temporal.PlainDateTime`.
4371 #[wasm_bindgen(method, js_name = since)]
4372 pub fn since_with_plain_date_time(this: &PlainTime, other: &PlainDateTime) -> Duration;
4373
4374 /// The `since()` method taking a `Temporal.PlainDateTime` and options; see [`PlainTime::since_with_options`]
4375 /// for errors.
4376 #[wasm_bindgen(method, js_name = since, catch)]
4377 pub fn since_with_plain_date_time_and_options(
4378 this: &PlainTime,
4379 other: &PlainDateTime,
4380 options: &DifferenceOptions,
4381 ) -> Result<Duration, RangeError>;
4382
4383 /// The `since()` method taking a `Temporal.ZonedDateTime`.
4384 #[wasm_bindgen(method, js_name = since)]
4385 pub fn since_with_zoned_date_time(this: &PlainTime, other: &ZonedDateTime) -> Duration;
4386
4387 /// The `since()` method taking a `Temporal.ZonedDateTime` and options; see [`PlainTime::since_with_options`]
4388 /// for errors.
4389 #[wasm_bindgen(method, js_name = since, catch)]
4390 pub fn since_with_zoned_date_time_and_options(
4391 this: &PlainTime,
4392 other: &ZonedDateTime,
4393 options: &DifferenceOptions,
4394 ) -> Result<Duration, RangeError>;
4395
4396 /// The `since()` method taking a property bag; throws a `TypeError` if required fields are missing.
4397 #[wasm_bindgen(method, js_name = since, catch)]
4398 pub fn since_with_plain_time_like(
4399 this: &PlainTime,
4400 other: &PlainTimeLike,
4401 ) -> Result<Duration, Error>;
4402
4403 /// The `since()` method taking a property bag and options; throws a `TypeError` if required
4404 /// fields are missing. See [`PlainTime::since_with_options`] for the remaining errors.
4405 #[wasm_bindgen(method, js_name = since, catch)]
4406 pub fn since_with_plain_time_like_and_options(
4407 this: &PlainTime,
4408 other: &PlainTimeLike,
4409 options: &DifferenceOptions,
4410 ) -> Result<Duration, Error>;
4411
4412 /// The `since()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
4413 #[wasm_bindgen(method, js_name = since, catch)]
4414 pub fn since_with_str(this: &PlainTime, other: &str) -> Result<Duration, RangeError>;
4415
4416 /// The `since()` method taking an ISO 8601 string and options; see [`PlainTime::since_with_options`]
4417 /// for errors.
4418 #[wasm_bindgen(method, js_name = since, catch)]
4419 pub fn since_with_str_and_options(
4420 this: &PlainTime,
4421 other: &str,
4422 options: &DifferenceOptions,
4423 ) -> Result<Duration, RangeError>;
4424
4425 /// Shorthand for `round()` with only `smallestUnit` set.
4426 #[wasm_bindgen(method, js_name = round, catch)]
4427 pub fn round_with_unit(this: &PlainTime, smallest_unit: Unit) -> Result<PlainTime, RangeError>;
4428
4429 /// The `toLocaleString()` method returns a language-sensitive string representation
4430 /// of this time.
4431 ///
4432 /// # Errors
4433 /// Throws a `RangeError` if `locales` is invalid.
4434 ///
4435 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/toLocaleString)
4436 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
4437 pub fn to_locale_string(this: &PlainTime) -> Result<JsString, RangeError>;
4438
4439 /// The `toLocaleString()` method; see [`PlainTime::to_locale_string`] for errors.
4440 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
4441 pub fn to_locale_string_with_str(
4442 this: &PlainTime,
4443 locales: &str,
4444 ) -> Result<JsString, RangeError>;
4445
4446 /// The `toLocaleString()` method; see [`PlainTime::to_locale_string`] for errors.
4447 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
4448 pub fn to_locale_string_with_str_sequence(
4449 this: &PlainTime,
4450 locales: &[JsString],
4451 ) -> Result<JsString, RangeError>;
4452
4453 /// The `toLocaleString()` method with options; throws a `TypeError` if an option does not
4454 /// apply to this type or conflicts with another. See [`PlainTime::to_locale_string`] for the
4455 /// remaining errors.
4456 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
4457 pub fn to_locale_string_with_str_sequence_and_options(
4458 this: &PlainTime,
4459 locales: &[JsString],
4460 options: &Intl::DateTimeFormatOptions,
4461 ) -> Result<JsString, Error>;
4462
4463 /// The `toLocaleString()` method with options; `None` for `locales` uses the default locale.
4464 /// Throws a `TypeError` if an option does not apply to this type or conflicts with another.
4465 /// See [`PlainTime::to_locale_string`] for the remaining errors.
4466 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
4467 pub fn to_locale_string_with_options(
4468 this: &PlainTime,
4469 locales: Option<&str>,
4470 options: &Intl::DateTimeFormatOptions,
4471 ) -> Result<JsString, Error>;
4472
4473 /// The `toJSON()` method returns a string representation of this time
4474 /// suitable for JSON serialization.
4475 ///
4476 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/toJSON)
4477 #[wasm_bindgen(method, js_name = toJSON)]
4478 pub fn to_json(this: &PlainTime) -> JsString;
4479
4480 /// The `toString()` method returns an RFC 9557 string representation of this time.
4481 ///
4482 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/toString)
4483 #[wasm_bindgen(method, js_name = toString)]
4484 pub fn to_js_string(this: &PlainTime) -> JsString;
4485
4486 /// The `toString()` method returns an RFC 9557 string representation of this time,
4487 /// formatted according to `options`.
4488 ///
4489 /// # Errors
4490 /// Throws a `RangeError` if the options are invalid for this type.
4491 ///
4492 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainTime/toString)
4493 #[wasm_bindgen(method, js_name = toString, catch)]
4494 pub fn to_js_string_with_options(
4495 this: &PlainTime,
4496 options: &ToStringPrecisionOptions,
4497 ) -> Result<JsString, RangeError>;
4498
4499}
4500
4501#[wasm_bindgen]
4502extern "C" {
4503 /// A `Temporal.PlainYearMonth` represents a particular month on the calendar. For example,
4504 /// it could be used to represent a particular instance of a monthly recurring event, like
4505 /// "the June 2019 meeting".
4506 ///
4507 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth)
4508 #[wasm_bindgen(js_namespace = Temporal, extends = Object)]
4509 #[derive(Clone, Debug)]
4510 pub type PlainYearMonth;
4511
4512 /// The `Temporal.PlainYearMonth()` constructor creates `Temporal.PlainYearMonth` objects.
4513 /// `calendar` defaults to ISO 8601; `reference_iso_day` selects the ISO day
4514 /// used to represent the month in non-ISO calendars.
4515 ///
4516 /// # Errors
4517 /// Throws a `RangeError` if any field is out of range or `calendar` is not a
4518 /// supported calendar identifier.
4519 ///
4520 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/PlainYearMonth)
4521 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4522 pub fn new(iso_year: i32, iso_month: u32) -> Result<PlainYearMonth, RangeError>;
4523
4524 /// The `Temporal.PlainYearMonth()` constructor; see [`PlainYearMonth::new`] for errors.
4525 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4526 pub fn new_with_calendar(
4527 iso_year: i32,
4528 iso_month: u32,
4529 calendar: &str,
4530 ) -> Result<PlainYearMonth, RangeError>;
4531
4532 /// The `Temporal.PlainYearMonth()` constructor; see [`PlainYearMonth::new`] for errors.
4533 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
4534 pub fn new_with_calendar_and_reference_iso_day(
4535 iso_year: i32,
4536 iso_month: u32,
4537 calendar: &str,
4538 reference_iso_day: u32,
4539 ) -> Result<PlainYearMonth, RangeError>;
4540
4541 /// The `Temporal.PlainYearMonth.from()` static method creates a new `Temporal.PlainYearMonth`
4542 /// object from another value.
4543 ///
4544 /// # Errors
4545 /// Throws a `RangeError` if the string is invalid or values are out of range
4546 /// (when `overflow` is `'reject'`).
4547 ///
4548 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/from)
4549 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4550 pub fn from_with_str(item: &str) -> Result<PlainYearMonth, RangeError>;
4551
4552 /// The `Temporal.PlainYearMonth.from()` static method; see [`PlainYearMonth::from_with_str`] for errors.
4553 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4554 pub fn from_with_str_and_options(
4555 item: &str,
4556 options: &OverflowOptions,
4557 ) -> Result<PlainYearMonth, RangeError>;
4558
4559 /// The `Temporal.PlainYearMonth.from()` static method taking a property bag; throws a `TypeError` if
4560 /// required fields are missing. See [`PlainYearMonth::from_with_str`] for the remaining errors.
4561 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4562 pub fn from_with_plain_year_month_like(
4563 item: &PlainYearMonthLike,
4564 ) -> Result<PlainYearMonth, Error>;
4565
4566 /// The `Temporal.PlainYearMonth.from()` static method taking a property bag; throws a `TypeError` if
4567 /// required fields are missing. See [`PlainYearMonth::from_with_str`] for the remaining errors.
4568 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4569 pub fn from_with_plain_year_month_like_and_options(
4570 item: &PlainYearMonthLike,
4571 options: &OverflowOptions,
4572 ) -> Result<PlainYearMonth, Error>;
4573
4574 /// The `Temporal.PlainYearMonth.from()` static method.
4575 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from)]
4576 pub fn from_with_plain_year_month(item: &PlainYearMonth) -> PlainYearMonth;
4577
4578 /// The `Temporal.PlainYearMonth.from()` static method.
4579 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from)]
4580 pub fn from_with_plain_year_month_and_options(
4581 item: &PlainYearMonth,
4582 options: &OverflowOptions,
4583 ) -> PlainYearMonth;
4584
4585 /// The `Temporal.PlainYearMonth.compare()` static method returns -1, 0, or 1 depending
4586 /// on whether `one` comes before, is equal to, or comes after `two`.
4587 ///
4588 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/compare)
4589 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal)]
4590 pub fn compare(one: &PlainYearMonth, two: &PlainYearMonth) -> i32;
4591
4592 /// The `Temporal.PlainYearMonth.from()` static method.
4593 ///
4594 /// # Errors
4595 /// Throws a `RangeError` if the first day of the month falls outside the representable range.
4596 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4597 pub fn from_with_plain_date(item: &PlainDate) -> Result<PlainYearMonth, RangeError>;
4598
4599 /// The `Temporal.PlainYearMonth.from()` static method; see
4600 /// [`PlainYearMonth::from_with_plain_date`] for errors.
4601 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4602 pub fn from_with_plain_date_and_options(
4603 item: &PlainDate,
4604 options: &OverflowOptions,
4605 ) -> Result<PlainYearMonth, RangeError>;
4606
4607 /// The `Temporal.PlainYearMonth.from()` static method.
4608 ///
4609 /// # Errors
4610 /// Throws a `RangeError` if the first day of the month falls outside the representable range.
4611 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4612 pub fn from_with_plain_date_time(item: &PlainDateTime) -> Result<PlainYearMonth, RangeError>;
4613
4614 /// The `Temporal.PlainYearMonth.from()` static method; see
4615 /// [`PlainYearMonth::from_with_plain_date_time`] for errors.
4616 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4617 pub fn from_with_plain_date_time_and_options(
4618 item: &PlainDateTime,
4619 options: &OverflowOptions,
4620 ) -> Result<PlainYearMonth, RangeError>;
4621
4622 /// The `Temporal.PlainYearMonth.from()` static method.
4623 ///
4624 /// # Errors
4625 /// Throws a `RangeError` if the first day of the month falls outside the representable range.
4626 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4627 pub fn from_with_zoned_date_time(item: &ZonedDateTime) -> Result<PlainYearMonth, RangeError>;
4628
4629 /// The `Temporal.PlainYearMonth.from()` static method; see
4630 /// [`PlainYearMonth::from_with_zoned_date_time`] for errors.
4631 #[wasm_bindgen(static_method_of = PlainYearMonth, js_namespace = Temporal, js_name = from, catch)]
4632 pub fn from_with_zoned_date_time_and_options(
4633 item: &ZonedDateTime,
4634 options: &OverflowOptions,
4635 ) -> Result<PlainYearMonth, RangeError>;
4636
4637 /// The `era` accessor property returns a calendar-specific lowercase string
4638 /// representing the era of this year-month, or `None` if the calendar does not use eras.
4639 ///
4640 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/era)
4641 #[wasm_bindgen(method, getter)]
4642 pub fn era(this: &PlainYearMonth) -> Option<JsString>;
4643
4644 /// The `eraYear` accessor property returns a non-negative integer representing the
4645 /// year of this year-month within the era, or `None` if the calendar does not use eras.
4646 ///
4647 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/eraYear)
4648 #[wasm_bindgen(method, getter = eraYear)]
4649 pub fn era_year(this: &PlainYearMonth) -> Option<i32>;
4650
4651 /// The `year` accessor property returns an integer representing the number of years
4652 /// of this year-month relative to the start of a calendar-specific epoch year.
4653 ///
4654 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/year)
4655 #[wasm_bindgen(method, getter)]
4656 pub fn year(this: &PlainYearMonth) -> i32;
4657
4658 /// The `month` accessor property returns a positive integer representing the
4659 /// 1-based month index in the year of this year-month.
4660 ///
4661 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/month)
4662 #[wasm_bindgen(method, getter)]
4663 pub fn month(this: &PlainYearMonth) -> u32;
4664
4665 /// The `monthCode` accessor property returns a calendar-specific string representing
4666 /// the month of this year-month.
4667 ///
4668 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/monthCode)
4669 #[wasm_bindgen(method, getter = monthCode)]
4670 pub fn month_code(this: &PlainYearMonth) -> JsString;
4671
4672 /// The `calendarId` accessor property returns a string representing the calendar
4673 /// used to interpret the internal ISO 8601 date.
4674 ///
4675 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/calendarId)
4676 #[wasm_bindgen(method, getter = calendarId)]
4677 pub fn calendar_id(this: &PlainYearMonth) -> JsString;
4678
4679 /// The `daysInMonth` accessor property returns a positive integer representing the
4680 /// number of days in the month of this year-month.
4681 ///
4682 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/daysInMonth)
4683 #[wasm_bindgen(method, getter = daysInMonth)]
4684 pub fn days_in_month(this: &PlainYearMonth) -> u32;
4685
4686 /// The `daysInYear` accessor property returns a positive integer representing the
4687 /// number of days in the year of this year-month.
4688 ///
4689 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/daysInYear)
4690 #[wasm_bindgen(method, getter = daysInYear)]
4691 pub fn days_in_year(this: &PlainYearMonth) -> u32;
4692
4693 /// The `monthsInYear` accessor property returns a positive integer representing the
4694 /// number of months in the year of this year-month.
4695 ///
4696 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/monthsInYear)
4697 #[wasm_bindgen(method, getter = monthsInYear)]
4698 pub fn months_in_year(this: &PlainYearMonth) -> u32;
4699
4700 /// The `inLeapYear` accessor property returns `true` if this year-month is in a leap year,
4701 /// and `false` otherwise.
4702 ///
4703 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/inLeapYear)
4704 #[wasm_bindgen(method, getter = inLeapYear)]
4705 pub fn in_leap_year(this: &PlainYearMonth) -> bool;
4706
4707 /// The `equals()` method returns `true` if this year-month is equivalent to `other`.
4708 ///
4709 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/equals)
4710 #[wasm_bindgen(method)]
4711 pub fn equals(this: &PlainYearMonth, other: &PlainYearMonth) -> bool;
4712
4713 /// The `with()` method returns a new `Temporal.PlainYearMonth` object with some
4714 /// fields replaced by new values.
4715 ///
4716 /// # Errors
4717 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
4718 /// of range or `overflow` is `'reject'` and a field would need constraining.
4719 ///
4720 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/with)
4721 #[wasm_bindgen(method, catch)]
4722 pub fn with(
4723 this: &PlainYearMonth,
4724 fields: &PlainYearMonthFields,
4725 ) -> Result<PlainYearMonth, Error>;
4726
4727 /// The `equals()` method taking a `Temporal.PlainDate`; throws a `RangeError` if the first day
4728 /// of its month falls outside the representable range.
4729 #[wasm_bindgen(method, js_name = equals, catch)]
4730 pub fn equals_with_plain_date(
4731 this: &PlainYearMonth,
4732 other: &PlainDate,
4733 ) -> Result<bool, RangeError>;
4734
4735 /// The `equals()` method taking a `Temporal.PlainDateTime`; throws a `RangeError` if the first day
4736 /// of its month falls outside the representable range.
4737 #[wasm_bindgen(method, js_name = equals, catch)]
4738 pub fn equals_with_plain_date_time(
4739 this: &PlainYearMonth,
4740 other: &PlainDateTime,
4741 ) -> Result<bool, RangeError>;
4742
4743 /// The `equals()` method taking a `Temporal.ZonedDateTime`; throws a `RangeError` if the first day
4744 /// of its month falls outside the representable range.
4745 #[wasm_bindgen(method, js_name = equals, catch)]
4746 pub fn equals_with_zoned_date_time(
4747 this: &PlainYearMonth,
4748 other: &ZonedDateTime,
4749 ) -> Result<bool, RangeError>;
4750
4751 /// The `equals()` method taking a property bag; throws a `TypeError` if required fields are missing.
4752 #[wasm_bindgen(method, js_name = equals, catch)]
4753 pub fn equals_with_plain_year_month_like(
4754 this: &PlainYearMonth,
4755 other: &PlainYearMonthLike,
4756 ) -> Result<bool, Error>;
4757
4758 /// The `equals()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
4759 #[wasm_bindgen(method, js_name = equals, catch)]
4760 pub fn equals_with_str(this: &PlainYearMonth, other: &str) -> Result<bool, RangeError>;
4761
4762 /// The `with()` method returns a new `Temporal.PlainYearMonth` object with some
4763 /// fields replaced by new values.
4764 ///
4765 /// # Errors
4766 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
4767 /// of range or `overflow` is `'reject'` and a field would need constraining.
4768 ///
4769 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/with)
4770 #[wasm_bindgen(method, js_name = with, catch)]
4771 pub fn with_with_options(
4772 this: &PlainYearMonth,
4773 fields: &PlainYearMonthFields,
4774 options: &OverflowOptions,
4775 ) -> Result<PlainYearMonth, Error>;
4776
4777 /// The `add()` method returns a new `Temporal.PlainYearMonth` object with the
4778 /// duration added to this year-month.
4779 ///
4780 /// # Errors
4781 /// Throws a `RangeError` if the result is out of range, if `overflow` is `'reject'` and a
4782 /// field would need constraining, or if the duration has units smaller than a month.
4783 ///
4784 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/add)
4785 #[wasm_bindgen(method, catch)]
4786 pub fn add(this: &PlainYearMonth, duration: &Duration) -> Result<PlainYearMonth, RangeError>;
4787
4788 /// The `add()` method returns a new `Temporal.PlainYearMonth` object with the
4789 /// duration added to this year-month.
4790 ///
4791 /// # Errors
4792 /// Throws a `RangeError` if the result is out of range, if `overflow` is `'reject'` and a
4793 /// field would need constraining, or if the duration has units smaller than a month.
4794 ///
4795 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/add)
4796 #[wasm_bindgen(method, js_name = add, catch)]
4797 pub fn add_with_options(
4798 this: &PlainYearMonth,
4799 duration: &Duration,
4800 options: &OverflowOptions,
4801 ) -> Result<PlainYearMonth, RangeError>;
4802
4803 /// The `add()` method taking a duration property bag.
4804 ///
4805 /// # Errors
4806 /// Throws a `TypeError` if no duration field is set; see [`PlainYearMonth::add`] for the remaining errors.
4807 #[wasm_bindgen(method, js_name = add, catch)]
4808 pub fn add_with_duration_like(
4809 this: &PlainYearMonth,
4810 duration: &DurationLike,
4811 ) -> Result<PlainYearMonth, Error>;
4812
4813 /// The `add()` method taking a duration property bag and options; see
4814 /// [`PlainYearMonth::add_with_duration_like`] for errors.
4815 #[wasm_bindgen(method, js_name = add, catch)]
4816 pub fn add_with_duration_like_and_options(
4817 this: &PlainYearMonth,
4818 duration: &DurationLike,
4819 options: &OverflowOptions,
4820 ) -> Result<PlainYearMonth, Error>;
4821
4822 /// The `add()` method taking an ISO 8601 duration string and options; see
4823 /// [`PlainYearMonth::add_with_str`] for errors.
4824 #[wasm_bindgen(method, js_name = add, catch)]
4825 pub fn add_with_str_and_options(
4826 this: &PlainYearMonth,
4827 duration: &str,
4828 options: &OverflowOptions,
4829 ) -> Result<PlainYearMonth, RangeError>;
4830
4831 /// The `add()` method taking an ISO 8601 duration string.
4832 ///
4833 /// # Errors
4834 /// Throws a `RangeError` if the string is not a valid duration; see [`PlainYearMonth::add`] for the remaining errors.
4835 #[wasm_bindgen(method, js_name = add, catch)]
4836 pub fn add_with_str(
4837 this: &PlainYearMonth,
4838 duration: &str,
4839 ) -> Result<PlainYearMonth, RangeError>;
4840
4841 /// The `subtract()` method returns a new `Temporal.PlainYearMonth` object with the
4842 /// duration subtracted from this year-month.
4843 ///
4844 /// # Errors
4845 /// Throws a `RangeError` if the result is out of range, if `overflow` is `'reject'` and a
4846 /// field would need constraining, or if the duration has units smaller than a month.
4847 ///
4848 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/subtract)
4849 #[wasm_bindgen(method, catch)]
4850 pub fn subtract(
4851 this: &PlainYearMonth,
4852 duration: &Duration,
4853 ) -> Result<PlainYearMonth, RangeError>;
4854
4855 /// The `subtract()` method returns a new `Temporal.PlainYearMonth` object with the
4856 /// duration subtracted from this year-month.
4857 ///
4858 /// # Errors
4859 /// Throws a `RangeError` if the result is out of range, if `overflow` is `'reject'` and a
4860 /// field would need constraining, or if the duration has units smaller than a month.
4861 ///
4862 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/subtract)
4863 #[wasm_bindgen(method, js_name = subtract, catch)]
4864 pub fn subtract_with_options(
4865 this: &PlainYearMonth,
4866 duration: &Duration,
4867 options: &OverflowOptions,
4868 ) -> Result<PlainYearMonth, RangeError>;
4869
4870 /// The `subtract()` method taking a duration property bag.
4871 ///
4872 /// # Errors
4873 /// Throws a `TypeError` if no duration field is set; see [`PlainYearMonth::subtract`] for the remaining errors.
4874 #[wasm_bindgen(method, js_name = subtract, catch)]
4875 pub fn subtract_with_duration_like(
4876 this: &PlainYearMonth,
4877 duration: &DurationLike,
4878 ) -> Result<PlainYearMonth, Error>;
4879
4880 /// The `subtract()` method taking a duration property bag and options; see
4881 /// [`PlainYearMonth::subtract_with_duration_like`] for errors.
4882 #[wasm_bindgen(method, js_name = subtract, catch)]
4883 pub fn subtract_with_duration_like_and_options(
4884 this: &PlainYearMonth,
4885 duration: &DurationLike,
4886 options: &OverflowOptions,
4887 ) -> Result<PlainYearMonth, Error>;
4888
4889 /// The `subtract()` method taking an ISO 8601 duration string and options; see
4890 /// [`PlainYearMonth::subtract_with_str`] for errors.
4891 #[wasm_bindgen(method, js_name = subtract, catch)]
4892 pub fn subtract_with_str_and_options(
4893 this: &PlainYearMonth,
4894 duration: &str,
4895 options: &OverflowOptions,
4896 ) -> Result<PlainYearMonth, RangeError>;
4897
4898 /// The `subtract()` method taking an ISO 8601 duration string.
4899 ///
4900 /// # Errors
4901 /// Throws a `RangeError` if the string is not a valid duration; see [`PlainYearMonth::subtract`] for the remaining errors.
4902 #[wasm_bindgen(method, js_name = subtract, catch)]
4903 pub fn subtract_with_str(
4904 this: &PlainYearMonth,
4905 duration: &str,
4906 ) -> Result<PlainYearMonth, RangeError>;
4907
4908 /// The `until()` method returns a `Temporal.Duration` representing the duration
4909 /// from this year-month until `other`.
4910 ///
4911 /// # Errors
4912 /// Throws a `RangeError` if dates have different calendars or options are invalid.
4913 ///
4914 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/until)
4915 #[wasm_bindgen(method, catch)]
4916 pub fn until(this: &PlainYearMonth, other: &PlainYearMonth) -> Result<Duration, RangeError>;
4917
4918 /// The `until()` method returns a `Temporal.Duration` representing the duration
4919 /// from this year-month until `other`.
4920 ///
4921 /// # Errors
4922 /// Throws a `RangeError` if dates have different calendars or options are invalid.
4923 ///
4924 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/until)
4925 #[wasm_bindgen(method, js_name = until, catch)]
4926 pub fn until_with_options(
4927 this: &PlainYearMonth,
4928 other: &PlainYearMonth,
4929 options: &DifferenceOptions,
4930 ) -> Result<Duration, RangeError>;
4931
4932 /// The `since()` method returns a `Temporal.Duration` representing the duration
4933 /// from `other` until this year-month.
4934 ///
4935 /// # Errors
4936 /// Throws a `RangeError` if dates have different calendars or options are invalid.
4937 ///
4938 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/since)
4939 #[wasm_bindgen(method, catch)]
4940 pub fn since(this: &PlainYearMonth, other: &PlainYearMonth) -> Result<Duration, RangeError>;
4941
4942 /// The `until()` method taking a `Temporal.PlainDate`; see [`PlainYearMonth::until`] for errors.
4943 #[wasm_bindgen(method, js_name = until, catch)]
4944 pub fn until_with_plain_date(
4945 this: &PlainYearMonth,
4946 other: &PlainDate,
4947 ) -> Result<Duration, RangeError>;
4948
4949 /// The `until()` method taking a `Temporal.PlainDate` and options; see [`PlainYearMonth::until_with_options`]
4950 /// for errors.
4951 #[wasm_bindgen(method, js_name = until, catch)]
4952 pub fn until_with_plain_date_and_options(
4953 this: &PlainYearMonth,
4954 other: &PlainDate,
4955 options: &DifferenceOptions,
4956 ) -> Result<Duration, RangeError>;
4957
4958 /// The `until()` method taking a `Temporal.PlainDateTime`; see [`PlainYearMonth::until`] for errors.
4959 #[wasm_bindgen(method, js_name = until, catch)]
4960 pub fn until_with_plain_date_time(
4961 this: &PlainYearMonth,
4962 other: &PlainDateTime,
4963 ) -> Result<Duration, RangeError>;
4964
4965 /// The `until()` method taking a `Temporal.PlainDateTime` and options; see [`PlainYearMonth::until_with_options`]
4966 /// for errors.
4967 #[wasm_bindgen(method, js_name = until, catch)]
4968 pub fn until_with_plain_date_time_and_options(
4969 this: &PlainYearMonth,
4970 other: &PlainDateTime,
4971 options: &DifferenceOptions,
4972 ) -> Result<Duration, RangeError>;
4973
4974 /// The `until()` method taking a `Temporal.ZonedDateTime`; see [`PlainYearMonth::until`] for errors.
4975 #[wasm_bindgen(method, js_name = until, catch)]
4976 pub fn until_with_zoned_date_time(
4977 this: &PlainYearMonth,
4978 other: &ZonedDateTime,
4979 ) -> Result<Duration, RangeError>;
4980
4981 /// The `until()` method taking a `Temporal.ZonedDateTime` and options; see [`PlainYearMonth::until_with_options`]
4982 /// for errors.
4983 #[wasm_bindgen(method, js_name = until, catch)]
4984 pub fn until_with_zoned_date_time_and_options(
4985 this: &PlainYearMonth,
4986 other: &ZonedDateTime,
4987 options: &DifferenceOptions,
4988 ) -> Result<Duration, RangeError>;
4989
4990 /// The `until()` method taking a property bag; throws a `TypeError` if required fields are missing; see [`PlainYearMonth::until`] for the remaining errors.
4991 #[wasm_bindgen(method, js_name = until, catch)]
4992 pub fn until_with_plain_year_month_like(
4993 this: &PlainYearMonth,
4994 other: &PlainYearMonthLike,
4995 ) -> Result<Duration, Error>;
4996
4997 /// The `until()` method taking a property bag and options; throws a `TypeError` if required
4998 /// fields are missing. See [`PlainYearMonth::until_with_options`] for the remaining errors.
4999 #[wasm_bindgen(method, js_name = until, catch)]
5000 pub fn until_with_plain_year_month_like_and_options(
5001 this: &PlainYearMonth,
5002 other: &PlainYearMonthLike,
5003 options: &DifferenceOptions,
5004 ) -> Result<Duration, Error>;
5005
5006 /// The `until()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`PlainYearMonth::until`] for the remaining errors.
5007 #[wasm_bindgen(method, js_name = until, catch)]
5008 pub fn until_with_str(this: &PlainYearMonth, other: &str) -> Result<Duration, RangeError>;
5009
5010 /// The `until()` method taking an ISO 8601 string and options; see [`PlainYearMonth::until_with_options`]
5011 /// for errors.
5012 #[wasm_bindgen(method, js_name = until, catch)]
5013 pub fn until_with_str_and_options(
5014 this: &PlainYearMonth,
5015 other: &str,
5016 options: &DifferenceOptions,
5017 ) -> Result<Duration, RangeError>;
5018
5019 /// The `since()` method returns a `Temporal.Duration` representing the duration
5020 /// from `other` until this year-month.
5021 ///
5022 /// # Errors
5023 /// Throws a `RangeError` if dates have different calendars or options are invalid.
5024 ///
5025 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/since)
5026 #[wasm_bindgen(method, js_name = since, catch)]
5027 pub fn since_with_options(
5028 this: &PlainYearMonth,
5029 other: &PlainYearMonth,
5030 options: &DifferenceOptions,
5031 ) -> Result<Duration, RangeError>;
5032
5033 /// The `toPlainDate()` method returns a `Temporal.PlainDate` object representing
5034 /// this year-month with the given day.
5035 ///
5036 /// # Errors
5037 /// Throws a `TypeError` if `day` is not set and a `RangeError` if it is not a positive
5038 /// integer. A day past the end of the month is constrained to the last day.
5039 ///
5040 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/toPlainDate)
5041 #[wasm_bindgen(method, js_name = toPlainDate, catch)]
5042 pub fn to_plain_date_with_fields(
5043 this: &PlainYearMonth,
5044 fields: &PlainDateFields,
5045 ) -> Result<PlainDate, Error>;
5046
5047 /// The `since()` method taking a `Temporal.PlainDate`; see [`PlainYearMonth::since`] for errors.
5048 #[wasm_bindgen(method, js_name = since, catch)]
5049 pub fn since_with_plain_date(
5050 this: &PlainYearMonth,
5051 other: &PlainDate,
5052 ) -> Result<Duration, RangeError>;
5053
5054 /// The `since()` method taking a `Temporal.PlainDate` and options; see [`PlainYearMonth::since_with_options`]
5055 /// for errors.
5056 #[wasm_bindgen(method, js_name = since, catch)]
5057 pub fn since_with_plain_date_and_options(
5058 this: &PlainYearMonth,
5059 other: &PlainDate,
5060 options: &DifferenceOptions,
5061 ) -> Result<Duration, RangeError>;
5062
5063 /// The `since()` method taking a `Temporal.PlainDateTime`; see [`PlainYearMonth::since`] for errors.
5064 #[wasm_bindgen(method, js_name = since, catch)]
5065 pub fn since_with_plain_date_time(
5066 this: &PlainYearMonth,
5067 other: &PlainDateTime,
5068 ) -> Result<Duration, RangeError>;
5069
5070 /// The `since()` method taking a `Temporal.PlainDateTime` and options; see [`PlainYearMonth::since_with_options`]
5071 /// for errors.
5072 #[wasm_bindgen(method, js_name = since, catch)]
5073 pub fn since_with_plain_date_time_and_options(
5074 this: &PlainYearMonth,
5075 other: &PlainDateTime,
5076 options: &DifferenceOptions,
5077 ) -> Result<Duration, RangeError>;
5078
5079 /// The `since()` method taking a `Temporal.ZonedDateTime`; see [`PlainYearMonth::since`] for errors.
5080 #[wasm_bindgen(method, js_name = since, catch)]
5081 pub fn since_with_zoned_date_time(
5082 this: &PlainYearMonth,
5083 other: &ZonedDateTime,
5084 ) -> Result<Duration, RangeError>;
5085
5086 /// The `since()` method taking a `Temporal.ZonedDateTime` and options; see [`PlainYearMonth::since_with_options`]
5087 /// for errors.
5088 #[wasm_bindgen(method, js_name = since, catch)]
5089 pub fn since_with_zoned_date_time_and_options(
5090 this: &PlainYearMonth,
5091 other: &ZonedDateTime,
5092 options: &DifferenceOptions,
5093 ) -> Result<Duration, RangeError>;
5094
5095 /// The `since()` method taking a property bag; throws a `TypeError` if required fields are missing; see [`PlainYearMonth::since`] for the remaining errors.
5096 #[wasm_bindgen(method, js_name = since, catch)]
5097 pub fn since_with_plain_year_month_like(
5098 this: &PlainYearMonth,
5099 other: &PlainYearMonthLike,
5100 ) -> Result<Duration, Error>;
5101
5102 /// The `since()` method taking a property bag and options; throws a `TypeError` if required
5103 /// fields are missing. See [`PlainYearMonth::since_with_options`] for the remaining errors.
5104 #[wasm_bindgen(method, js_name = since, catch)]
5105 pub fn since_with_plain_year_month_like_and_options(
5106 this: &PlainYearMonth,
5107 other: &PlainYearMonthLike,
5108 options: &DifferenceOptions,
5109 ) -> Result<Duration, Error>;
5110
5111 /// The `since()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`PlainYearMonth::since`] for the remaining errors.
5112 #[wasm_bindgen(method, js_name = since, catch)]
5113 pub fn since_with_str(this: &PlainYearMonth, other: &str) -> Result<Duration, RangeError>;
5114
5115 /// The `since()` method taking an ISO 8601 string and options; see [`PlainYearMonth::since_with_options`]
5116 /// for errors.
5117 #[wasm_bindgen(method, js_name = since, catch)]
5118 pub fn since_with_str_and_options(
5119 this: &PlainYearMonth,
5120 other: &str,
5121 options: &DifferenceOptions,
5122 ) -> Result<Duration, RangeError>;
5123
5124 /// The `toLocaleString()` method returns a language-sensitive string representation
5125 /// of this year-month.
5126 ///
5127 /// # Errors
5128 /// Throws a `RangeError` if `locales` is invalid or the locale's calendar does
5129 /// not match this value's calendar.
5130 ///
5131 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/toLocaleString)
5132 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5133 pub fn to_locale_string(this: &PlainYearMonth) -> Result<JsString, RangeError>;
5134
5135 /// The `toLocaleString()` method; see [`PlainYearMonth::to_locale_string`] for errors.
5136 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5137 pub fn to_locale_string_with_str(
5138 this: &PlainYearMonth,
5139 locales: &str,
5140 ) -> Result<JsString, RangeError>;
5141
5142 /// The `toLocaleString()` method; see [`PlainYearMonth::to_locale_string`] for errors.
5143 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5144 pub fn to_locale_string_with_str_sequence(
5145 this: &PlainYearMonth,
5146 locales: &[JsString],
5147 ) -> Result<JsString, RangeError>;
5148
5149 /// The `toLocaleString()` method with options; throws a `TypeError` if an option does not
5150 /// apply to this type or conflicts with another. See [`PlainYearMonth::to_locale_string`] for the
5151 /// remaining errors.
5152 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5153 pub fn to_locale_string_with_str_sequence_and_options(
5154 this: &PlainYearMonth,
5155 locales: &[JsString],
5156 options: &Intl::DateTimeFormatOptions,
5157 ) -> Result<JsString, Error>;
5158
5159 /// The `toLocaleString()` method with options; `None` for `locales` uses the default locale.
5160 /// Throws a `TypeError` if an option does not apply to this type or conflicts with another.
5161 /// See [`PlainYearMonth::to_locale_string`] for the remaining errors.
5162 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5163 pub fn to_locale_string_with_options(
5164 this: &PlainYearMonth,
5165 locales: Option<&str>,
5166 options: &Intl::DateTimeFormatOptions,
5167 ) -> Result<JsString, Error>;
5168
5169 /// The `toJSON()` method returns a string representation of this year-month
5170 /// suitable for JSON serialization.
5171 ///
5172 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/toJSON)
5173 #[wasm_bindgen(method, js_name = toJSON)]
5174 pub fn to_json(this: &PlainYearMonth) -> JsString;
5175
5176 /// The `toString()` method returns an RFC 9557 string representation of this year-month.
5177 ///
5178 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/toString)
5179 #[wasm_bindgen(method, js_name = toString)]
5180 pub fn to_js_string(this: &PlainYearMonth) -> JsString;
5181
5182 /// The `toString()` method returns an RFC 9557 string representation of this year-month,
5183 /// formatted according to `options`.
5184 ///
5185 /// # Errors
5186 /// Throws a `RangeError` if the options are invalid for this type.
5187 ///
5188 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainYearMonth/toString)
5189 #[wasm_bindgen(method, js_name = toString, catch)]
5190 pub fn to_js_string_with_options(
5191 this: &PlainYearMonth,
5192 options: &ShowCalendarOptions,
5193 ) -> Result<JsString, RangeError>;
5194}
5195
5196impl PlainYearMonth {
5197 /// The `toPlainDate()` method returns a `Temporal.PlainDate` object representing
5198 /// this year-month on the given day of the month; see [`PlainYearMonth::to_plain_date_with_fields`] for errors.
5199 pub fn to_plain_date(&self, day: u32) -> Result<PlainDate, RangeError> {
5200 let fields = PlainDateFields::new();
5201 fields.set_day(day);
5202 self.to_plain_date_with_fields(&fields)
5203 .map_err(JsCast::unchecked_into)
5204 }
5205}
5206
5207#[wasm_bindgen]
5208extern "C" {
5209 /// A `Temporal.PlainMonthDay` represents a particular day on the calendar, but without
5210 /// a year. For example, it could be used to represent a yearly recurring event, like
5211 /// "Bastille Day is on the 14th of July."
5212 ///
5213 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay)
5214 #[wasm_bindgen(js_namespace = Temporal, extends = Object)]
5215 #[derive(Clone, Debug)]
5216 pub type PlainMonthDay;
5217
5218 /// The `Temporal.PlainMonthDay()` constructor creates `Temporal.PlainMonthDay` objects.
5219 /// `calendar` defaults to ISO 8601; `reference_iso_year` selects the ISO year
5220 /// used to represent the month-day in non-ISO calendars.
5221 ///
5222 /// # Errors
5223 /// Throws a `RangeError` if any field is out of range or `calendar` is not a
5224 /// supported calendar identifier.
5225 ///
5226 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/PlainMonthDay)
5227 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
5228 pub fn new(iso_month: u32, iso_day: u32) -> Result<PlainMonthDay, RangeError>;
5229
5230 /// The `Temporal.PlainMonthDay()` constructor; see [`PlainMonthDay::new`] for errors.
5231 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
5232 pub fn new_with_calendar(
5233 iso_month: u32,
5234 iso_day: u32,
5235 calendar: &str,
5236 ) -> Result<PlainMonthDay, RangeError>;
5237
5238 /// The `Temporal.PlainMonthDay()` constructor; see [`PlainMonthDay::new`] for errors.
5239 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
5240 pub fn new_with_calendar_and_reference_iso_year(
5241 iso_month: u32,
5242 iso_day: u32,
5243 calendar: &str,
5244 reference_iso_year: i32,
5245 ) -> Result<PlainMonthDay, RangeError>;
5246
5247 /// The `Temporal.PlainMonthDay.from()` static method creates a new `Temporal.PlainMonthDay`
5248 /// object from another value.
5249 ///
5250 /// # Errors
5251 /// Throws a `RangeError` if the string is invalid or values are out of range
5252 /// (when `overflow` is `'reject'`).
5253 ///
5254 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/from)
5255 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from, catch)]
5256 pub fn from_with_str(item: &str) -> Result<PlainMonthDay, RangeError>;
5257
5258 /// The `Temporal.PlainMonthDay.from()` static method; see [`PlainMonthDay::from_with_str`] for errors.
5259 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from, catch)]
5260 pub fn from_with_str_and_options(
5261 item: &str,
5262 options: &OverflowOptions,
5263 ) -> Result<PlainMonthDay, RangeError>;
5264
5265 /// The `Temporal.PlainMonthDay.from()` static method taking a property bag; throws a `TypeError` if
5266 /// required fields are missing. See [`PlainMonthDay::from_with_str`] for the remaining errors.
5267 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from, catch)]
5268 pub fn from_with_plain_month_day_like(item: &PlainMonthDayLike)
5269 -> Result<PlainMonthDay, Error>;
5270
5271 /// The `Temporal.PlainMonthDay.from()` static method taking a property bag; throws a `TypeError` if
5272 /// required fields are missing. See [`PlainMonthDay::from_with_str`] for the remaining errors.
5273 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from, catch)]
5274 pub fn from_with_plain_month_day_like_and_options(
5275 item: &PlainMonthDayLike,
5276 options: &OverflowOptions,
5277 ) -> Result<PlainMonthDay, Error>;
5278
5279 /// The `Temporal.PlainMonthDay.from()` static method.
5280 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from)]
5281 pub fn from_with_plain_month_day(item: &PlainMonthDay) -> PlainMonthDay;
5282
5283 /// The `Temporal.PlainMonthDay.from()` static method.
5284 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from)]
5285 pub fn from_with_plain_month_day_and_options(
5286 item: &PlainMonthDay,
5287 options: &OverflowOptions,
5288 ) -> PlainMonthDay;
5289
5290 /// The `monthCode` accessor property returns a calendar-specific string representing
5291 /// the month of this month-day.
5292 ///
5293 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/monthCode)
5294 #[wasm_bindgen(method, getter = monthCode)]
5295 pub fn month_code(this: &PlainMonthDay) -> JsString;
5296
5297 /// The `Temporal.PlainMonthDay.from()` static method.
5298 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from)]
5299 pub fn from_with_plain_date(item: &PlainDate) -> PlainMonthDay;
5300
5301 /// The `Temporal.PlainMonthDay.from()` static method.
5302 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from)]
5303 pub fn from_with_plain_date_and_options(
5304 item: &PlainDate,
5305 options: &OverflowOptions,
5306 ) -> PlainMonthDay;
5307
5308 /// The `Temporal.PlainMonthDay.from()` static method.
5309 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from)]
5310 pub fn from_with_plain_date_time(item: &PlainDateTime) -> PlainMonthDay;
5311
5312 /// The `Temporal.PlainMonthDay.from()` static method.
5313 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from)]
5314 pub fn from_with_plain_date_time_and_options(
5315 item: &PlainDateTime,
5316 options: &OverflowOptions,
5317 ) -> PlainMonthDay;
5318
5319 /// The `Temporal.PlainMonthDay.from()` static method.
5320 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from)]
5321 pub fn from_with_zoned_date_time(item: &ZonedDateTime) -> PlainMonthDay;
5322
5323 /// The `Temporal.PlainMonthDay.from()` static method.
5324 #[wasm_bindgen(static_method_of = PlainMonthDay, js_namespace = Temporal, js_name = from)]
5325 pub fn from_with_zoned_date_time_and_options(
5326 item: &ZonedDateTime,
5327 options: &OverflowOptions,
5328 ) -> PlainMonthDay;
5329
5330 /// The `day` accessor property returns a positive integer representing the
5331 /// day of the month.
5332 ///
5333 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/day)
5334 #[wasm_bindgen(method, getter)]
5335 pub fn day(this: &PlainMonthDay) -> u32;
5336
5337 /// The `calendarId` accessor property returns a string representing the calendar
5338 /// used to interpret the internal ISO 8601 date.
5339 ///
5340 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/calendarId)
5341 #[wasm_bindgen(method, getter = calendarId)]
5342 pub fn calendar_id(this: &PlainMonthDay) -> JsString;
5343
5344 /// The `equals()` method returns `true` if this month-day is equivalent to `other`.
5345 ///
5346 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/equals)
5347 #[wasm_bindgen(method)]
5348 pub fn equals(this: &PlainMonthDay, other: &PlainMonthDay) -> bool;
5349
5350 /// The `with()` method returns a new `Temporal.PlainMonthDay` object with some
5351 /// fields replaced by new values.
5352 ///
5353 /// # Errors
5354 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
5355 /// of range or `overflow` is `'reject'` and a field would need constraining.
5356 ///
5357 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/with)
5358 #[wasm_bindgen(method, catch)]
5359 pub fn with(this: &PlainMonthDay, fields: &PlainDateFields) -> Result<PlainMonthDay, Error>;
5360
5361 /// The `equals()` method taking a `Temporal.PlainDate`.
5362 #[wasm_bindgen(method, js_name = equals)]
5363 pub fn equals_with_plain_date(this: &PlainMonthDay, other: &PlainDate) -> bool;
5364
5365 /// The `equals()` method taking a `Temporal.PlainDateTime`.
5366 #[wasm_bindgen(method, js_name = equals)]
5367 pub fn equals_with_plain_date_time(this: &PlainMonthDay, other: &PlainDateTime) -> bool;
5368
5369 /// The `equals()` method taking a `Temporal.ZonedDateTime`.
5370 #[wasm_bindgen(method, js_name = equals)]
5371 pub fn equals_with_zoned_date_time(this: &PlainMonthDay, other: &ZonedDateTime) -> bool;
5372
5373 /// The `equals()` method taking a property bag; throws a `TypeError` if required fields are missing.
5374 #[wasm_bindgen(method, js_name = equals, catch)]
5375 pub fn equals_with_plain_month_day_like(
5376 this: &PlainMonthDay,
5377 other: &PlainMonthDayLike,
5378 ) -> Result<bool, Error>;
5379
5380 /// The `equals()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
5381 #[wasm_bindgen(method, js_name = equals, catch)]
5382 pub fn equals_with_str(this: &PlainMonthDay, other: &str) -> Result<bool, RangeError>;
5383
5384 /// The `with()` method returns a new `Temporal.PlainMonthDay` object with some
5385 /// fields replaced by new values.
5386 ///
5387 /// # Errors
5388 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
5389 /// of range or `overflow` is `'reject'` and a field would need constraining.
5390 ///
5391 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/with)
5392 #[wasm_bindgen(method, js_name = with, catch)]
5393 pub fn with_with_options(
5394 this: &PlainMonthDay,
5395 fields: &PlainDateFields,
5396 options: &OverflowOptions,
5397 ) -> Result<PlainMonthDay, Error>;
5398
5399 /// The `toPlainDate()` method returns a `Temporal.PlainDate` object representing
5400 /// this month-day in the given year.
5401 ///
5402 /// # Errors
5403 /// Throws a `TypeError` if neither `year` nor both `era` and `era_year` are set, and a
5404 /// `RangeError` if the result falls outside the representable range. A day that does not
5405 /// exist in the given year is constrained to the last day of the month.
5406 ///
5407 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/toPlainDate)
5408 #[wasm_bindgen(method, js_name = toPlainDate, catch)]
5409 pub fn to_plain_date_with_fields(
5410 this: &PlainMonthDay,
5411 fields: &PlainDateFields,
5412 ) -> Result<PlainDate, Error>;
5413
5414 /// The `toLocaleString()` method returns a language-sensitive string representation
5415 /// of this month-day.
5416 ///
5417 /// # Errors
5418 /// Throws a `RangeError` if `locales` is invalid or the locale's calendar does
5419 /// not match this value's calendar.
5420 ///
5421 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/toLocaleString)
5422 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5423 pub fn to_locale_string(this: &PlainMonthDay) -> Result<JsString, RangeError>;
5424
5425 /// The `toLocaleString()` method; see [`PlainMonthDay::to_locale_string`] for errors.
5426 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5427 pub fn to_locale_string_with_str(
5428 this: &PlainMonthDay,
5429 locales: &str,
5430 ) -> Result<JsString, RangeError>;
5431
5432 /// The `toLocaleString()` method; see [`PlainMonthDay::to_locale_string`] for errors.
5433 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5434 pub fn to_locale_string_with_str_sequence(
5435 this: &PlainMonthDay,
5436 locales: &[JsString],
5437 ) -> Result<JsString, RangeError>;
5438
5439 /// The `toLocaleString()` method with options; throws a `TypeError` if an option does not
5440 /// apply to this type or conflicts with another. See [`PlainMonthDay::to_locale_string`] for the
5441 /// remaining errors.
5442 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5443 pub fn to_locale_string_with_str_sequence_and_options(
5444 this: &PlainMonthDay,
5445 locales: &[JsString],
5446 options: &Intl::DateTimeFormatOptions,
5447 ) -> Result<JsString, Error>;
5448
5449 /// The `toLocaleString()` method with options; `None` for `locales` uses the default locale.
5450 /// Throws a `TypeError` if an option does not apply to this type or conflicts with another.
5451 /// See [`PlainMonthDay::to_locale_string`] for the remaining errors.
5452 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
5453 pub fn to_locale_string_with_options(
5454 this: &PlainMonthDay,
5455 locales: Option<&str>,
5456 options: &Intl::DateTimeFormatOptions,
5457 ) -> Result<JsString, Error>;
5458
5459 /// The `toJSON()` method returns a string representation of this month-day
5460 /// suitable for JSON serialization.
5461 ///
5462 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/toJSON)
5463 #[wasm_bindgen(method, js_name = toJSON)]
5464 pub fn to_json(this: &PlainMonthDay) -> JsString;
5465
5466 /// The `toString()` method returns an RFC 9557 string representation of this month-day.
5467 ///
5468 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/toString)
5469 #[wasm_bindgen(method, js_name = toString)]
5470 pub fn to_js_string(this: &PlainMonthDay) -> JsString;
5471
5472 /// The `toString()` method returns an RFC 9557 string representation of this month-day,
5473 /// formatted according to `options`.
5474 ///
5475 /// # Errors
5476 /// Throws a `RangeError` if the options are invalid for this type.
5477 ///
5478 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainMonthDay/toString)
5479 #[wasm_bindgen(method, js_name = toString, catch)]
5480 pub fn to_js_string_with_options(
5481 this: &PlainMonthDay,
5482 options: &ShowCalendarOptions,
5483 ) -> Result<JsString, RangeError>;
5484}
5485
5486impl PlainMonthDay {
5487 /// The `toPlainDate()` method returns a `Temporal.PlainDate` object representing
5488 /// this month-day in the given year; see [`PlainMonthDay::to_plain_date_with_fields`] for errors.
5489 pub fn to_plain_date(&self, year: i32) -> Result<PlainDate, RangeError> {
5490 let fields = PlainDateFields::new();
5491 fields.set_year(year);
5492 self.to_plain_date_with_fields(&fields)
5493 .map_err(JsCast::unchecked_into)
5494 }
5495}
5496
5497#[wasm_bindgen]
5498extern "C" {
5499 /// A `Temporal.PlainDate` represents a calendar date without time or time zone information.
5500 /// For example, it could be used to represent an event on a calendar which happens during
5501 /// the whole day no matter which time zone it's happening in.
5502 ///
5503 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate)
5504 #[wasm_bindgen(js_namespace = Temporal, extends = Object)]
5505 #[derive(Clone, Debug)]
5506 pub type PlainDate;
5507
5508 /// The `Temporal.PlainDate()` constructor creates `Temporal.PlainDate` objects
5509 /// in the ISO 8601 calendar.
5510 ///
5511 /// # Errors
5512 /// Throws a `RangeError` if any field is out of range.
5513 ///
5514 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/PlainDate)
5515 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
5516 pub fn new(iso_year: i32, iso_month: u32, iso_day: u32) -> Result<PlainDate, RangeError>;
5517
5518 /// The `Temporal.PlainDate()` constructor creates `Temporal.PlainDate` objects
5519 /// in the given calendar.
5520 ///
5521 /// # Errors
5522 /// Throws a `RangeError` if any field is out of range.
5523 /// Throws a `RangeError` if `calendar` is not a supported calendar identifier.
5524 ///
5525 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/PlainDate)
5526 #[wasm_bindgen(constructor, js_namespace = Temporal, catch)]
5527 pub fn new_with_calendar(
5528 iso_year: i32,
5529 iso_month: u32,
5530 iso_day: u32,
5531 calendar: &str,
5532 ) -> Result<PlainDate, RangeError>;
5533
5534 /// The `Temporal.PlainDate.from()` static method creates a new `Temporal.PlainDate`
5535 /// object from another value.
5536 ///
5537 /// # Errors
5538 /// Throws a `RangeError` if the string is invalid or values are out of range
5539 /// (when `overflow` is `'reject'`).
5540 ///
5541 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/from)
5542 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from, catch)]
5543 pub fn from_with_str(item: &str) -> Result<PlainDate, RangeError>;
5544
5545 /// The `Temporal.PlainDate.from()` static method; see [`PlainDate::from_with_str`] for errors.
5546 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from, catch)]
5547 pub fn from_with_str_and_options(
5548 item: &str,
5549 options: &OverflowOptions,
5550 ) -> Result<PlainDate, RangeError>;
5551
5552 /// The `Temporal.PlainDate.from()` static method taking a property bag; throws a `TypeError` if
5553 /// required fields are missing. See [`PlainDate::from_with_str`] for the remaining errors.
5554 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from, catch)]
5555 pub fn from_with_plain_date_like(item: &PlainDateLike) -> Result<PlainDate, Error>;
5556
5557 /// The `Temporal.PlainDate.from()` static method taking a property bag; throws a `TypeError` if
5558 /// required fields are missing. See [`PlainDate::from_with_str`] for the remaining errors.
5559 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from, catch)]
5560 pub fn from_with_plain_date_like_and_options(
5561 item: &PlainDateLike,
5562 options: &OverflowOptions,
5563 ) -> Result<PlainDate, Error>;
5564
5565 /// The `Temporal.PlainDate.from()` static method.
5566 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from)]
5567 pub fn from_with_plain_date(item: &PlainDate) -> PlainDate;
5568
5569 /// The `Temporal.PlainDate.from()` static method.
5570 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from)]
5571 pub fn from_with_plain_date_and_options(
5572 item: &PlainDate,
5573 options: &OverflowOptions,
5574 ) -> PlainDate;
5575
5576 /// The `Temporal.PlainDate.from()` static method.
5577 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from)]
5578 pub fn from_with_plain_date_time(item: &PlainDateTime) -> PlainDate;
5579
5580 /// The `Temporal.PlainDate.from()` static method.
5581 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from)]
5582 pub fn from_with_plain_date_time_and_options(
5583 item: &PlainDateTime,
5584 options: &OverflowOptions,
5585 ) -> PlainDate;
5586
5587 /// The `Temporal.PlainDate.from()` static method.
5588 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from)]
5589 pub fn from_with_zoned_date_time(item: &ZonedDateTime) -> PlainDate;
5590
5591 /// The `Temporal.PlainDate.from()` static method.
5592 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal, js_name = from)]
5593 pub fn from_with_zoned_date_time_and_options(
5594 item: &ZonedDateTime,
5595 options: &OverflowOptions,
5596 ) -> PlainDate;
5597
5598 /// The `Temporal.PlainDate.compare()` static method returns -1, 0, or 1 depending
5599 /// on whether `one` comes before, is equal to, or comes after `two`.
5600 ///
5601 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/compare)
5602 #[wasm_bindgen(static_method_of = PlainDate, js_namespace = Temporal)]
5603 pub fn compare(one: &PlainDate, two: &PlainDate) -> i32;
5604
5605 /// The `era` accessor property returns a calendar-specific lowercase string
5606 /// representing the era of this date, or `None` if the calendar does not use eras.
5607 ///
5608 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/era)
5609 #[wasm_bindgen(method, getter)]
5610 pub fn era(this: &PlainDate) -> Option<JsString>;
5611
5612 /// The `eraYear` accessor property returns a non-negative integer representing the
5613 /// year of this date within the era, or `None` if the calendar does not use eras.
5614 ///
5615 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/eraYear)
5616 #[wasm_bindgen(method, getter = eraYear)]
5617 pub fn era_year(this: &PlainDate) -> Option<i32>;
5618
5619 /// The `year` accessor property returns an integer representing the number of years
5620 /// of this date relative to the start of a calendar-specific epoch year.
5621 ///
5622 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/year)
5623 #[wasm_bindgen(method, getter)]
5624 pub fn year(this: &PlainDate) -> i32;
5625
5626 /// The `month` accessor property returns a positive integer representing the
5627 /// 1-based month index in the year of this date.
5628 ///
5629 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/month)
5630 #[wasm_bindgen(method, getter)]
5631 pub fn month(this: &PlainDate) -> u32;
5632
5633 /// The `monthCode` accessor property returns a calendar-specific string representing
5634 /// the month of this date.
5635 ///
5636 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/monthCode)
5637 #[wasm_bindgen(method, getter = monthCode)]
5638 pub fn month_code(this: &PlainDate) -> JsString;
5639
5640 /// The `day` accessor property returns a positive integer representing the
5641 /// 1-based day index in the month of this date.
5642 ///
5643 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/day)
5644 #[wasm_bindgen(method, getter)]
5645 pub fn day(this: &PlainDate) -> u32;
5646
5647 /// The `calendarId` accessor property returns a string representing the calendar
5648 /// used to interpret the internal ISO 8601 date.
5649 ///
5650 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/calendarId)
5651 #[wasm_bindgen(method, getter = calendarId)]
5652 pub fn calendar_id(this: &PlainDate) -> JsString;
5653
5654 /// The `dayOfWeek` accessor property returns a positive integer representing the
5655 /// day of the week of this date (1 = Monday through 7 = Sunday for ISO 8601).
5656 ///
5657 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/dayOfWeek)
5658 #[wasm_bindgen(method, getter = dayOfWeek)]
5659 pub fn day_of_week(this: &PlainDate) -> u32;
5660
5661 /// The `dayOfYear` accessor property returns a positive integer representing the
5662 /// 1-based day index of this date in the year.
5663 ///
5664 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/dayOfYear)
5665 #[wasm_bindgen(method, getter = dayOfYear)]
5666 pub fn day_of_year(this: &PlainDate) -> u32;
5667
5668 /// The `weekOfYear` accessor property returns a positive integer representing the
5669 /// 1-based week index in the `yearOfWeek` of this date, or `None` if the
5670 /// calendar does not have a well-defined week system.
5671 ///
5672 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/weekOfYear)
5673 #[wasm_bindgen(method, getter = weekOfYear)]
5674 pub fn week_of_year(this: &PlainDate) -> Option<u32>;
5675
5676 /// The `yearOfWeek` accessor property returns an integer representing the year
5677 /// to be paired with `weekOfYear`, or `None` if the calendar does not have
5678 /// a well-defined week system.
5679 ///
5680 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/yearOfWeek)
5681 #[wasm_bindgen(method, getter = yearOfWeek)]
5682 pub fn year_of_week(this: &PlainDate) -> Option<i32>;
5683
5684 /// The `daysInWeek` accessor property returns a positive integer representing the
5685 /// number of days in the week of this date.
5686 ///
5687 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/daysInWeek)
5688 #[wasm_bindgen(method, getter = daysInWeek)]
5689 pub fn days_in_week(this: &PlainDate) -> u32;
5690
5691 /// The `daysInMonth` accessor property returns a positive integer representing the
5692 /// number of days in the month of this date.
5693 ///
5694 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/daysInMonth)
5695 #[wasm_bindgen(method, getter = daysInMonth)]
5696 pub fn days_in_month(this: &PlainDate) -> u32;
5697
5698 /// The `daysInYear` accessor property returns a positive integer representing the
5699 /// number of days in the year of this date.
5700 ///
5701 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/daysInYear)
5702 #[wasm_bindgen(method, getter = daysInYear)]
5703 pub fn days_in_year(this: &PlainDate) -> u32;
5704
5705 /// The `monthsInYear` accessor property returns a positive integer representing the
5706 /// number of months in the year of this date.
5707 ///
5708 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/monthsInYear)
5709 #[wasm_bindgen(method, getter = monthsInYear)]
5710 pub fn months_in_year(this: &PlainDate) -> u32;
5711
5712 /// The `inLeapYear` accessor property returns `true` if this date is in a leap year,
5713 /// and `false` otherwise.
5714 ///
5715 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/inLeapYear)
5716 #[wasm_bindgen(method, getter = inLeapYear)]
5717 pub fn in_leap_year(this: &PlainDate) -> bool;
5718
5719 /// The `equals()` method returns `true` if this date is equivalent to `other`.
5720 ///
5721 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/equals)
5722 #[wasm_bindgen(method)]
5723 pub fn equals(this: &PlainDate, other: &PlainDate) -> bool;
5724
5725 /// The `with()` method returns a new `Temporal.PlainDate` object with some
5726 /// fields replaced by new values.
5727 ///
5728 /// # Errors
5729 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
5730 /// of range or `overflow` is `'reject'` and a field would need constraining.
5731 ///
5732 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/with)
5733 #[wasm_bindgen(method, catch)]
5734 pub fn with(this: &PlainDate, fields: &PlainDateFields) -> Result<PlainDate, Error>;
5735
5736 /// The `equals()` method taking a `Temporal.PlainDateTime`.
5737 #[wasm_bindgen(method, js_name = equals)]
5738 pub fn equals_with_plain_date_time(this: &PlainDate, other: &PlainDateTime) -> bool;
5739
5740 /// The `equals()` method taking a `Temporal.ZonedDateTime`.
5741 #[wasm_bindgen(method, js_name = equals)]
5742 pub fn equals_with_zoned_date_time(this: &PlainDate, other: &ZonedDateTime) -> bool;
5743
5744 /// The `equals()` method taking a property bag; throws a `TypeError` if required fields are missing.
5745 #[wasm_bindgen(method, js_name = equals, catch)]
5746 pub fn equals_with_plain_date_like(
5747 this: &PlainDate,
5748 other: &PlainDateLike,
5749 ) -> Result<bool, Error>;
5750
5751 /// The `equals()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid.
5752 #[wasm_bindgen(method, js_name = equals, catch)]
5753 pub fn equals_with_str(this: &PlainDate, other: &str) -> Result<bool, RangeError>;
5754
5755 /// The `with()` method returns a new `Temporal.PlainDate` object with some
5756 /// fields replaced by new values.
5757 ///
5758 /// # Errors
5759 /// Throws a `TypeError` if no recognised field is set, and a `RangeError` if values are out
5760 /// of range or `overflow` is `'reject'` and a field would need constraining.
5761 ///
5762 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/with)
5763 #[wasm_bindgen(method, js_name = with, catch)]
5764 pub fn with_with_options(
5765 this: &PlainDate,
5766 fields: &PlainDateFields,
5767 options: &OverflowOptions,
5768 ) -> Result<PlainDate, Error>;
5769
5770 /// The `withCalendar()` method returns a new `Temporal.PlainDate` object with
5771 /// the calendar replaced.
5772 ///
5773 /// # Errors
5774 /// Throws a `RangeError` if the calendar identifier is invalid.
5775 ///
5776 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/withCalendar)
5777 #[wasm_bindgen(method, js_name = withCalendar, catch)]
5778 pub fn with_calendar(this: &PlainDate, calendar: &str) -> Result<PlainDate, RangeError>;
5779
5780 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainDate`.
5781 #[wasm_bindgen(method, js_name = withCalendar)]
5782 pub fn with_calendar_with_plain_date(this: &PlainDate, calendar: &PlainDate) -> PlainDate;
5783
5784 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainDateTime`.
5785 #[wasm_bindgen(method, js_name = withCalendar)]
5786 pub fn with_calendar_with_plain_date_time(
5787 this: &PlainDate,
5788 calendar: &PlainDateTime,
5789 ) -> PlainDate;
5790
5791 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainYearMonth`.
5792 #[wasm_bindgen(method, js_name = withCalendar)]
5793 pub fn with_calendar_with_plain_year_month(
5794 this: &PlainDate,
5795 calendar: &PlainYearMonth,
5796 ) -> PlainDate;
5797
5798 /// The `withCalendar()` method taking the calendar of the given `Temporal.PlainMonthDay`.
5799 #[wasm_bindgen(method, js_name = withCalendar)]
5800 pub fn with_calendar_with_plain_month_day(
5801 this: &PlainDate,
5802 calendar: &PlainMonthDay,
5803 ) -> PlainDate;
5804
5805 /// The `withCalendar()` method taking the calendar of the given `Temporal.ZonedDateTime`.
5806 #[wasm_bindgen(method, js_name = withCalendar)]
5807 pub fn with_calendar_with_zoned_date_time(
5808 this: &PlainDate,
5809 calendar: &ZonedDateTime,
5810 ) -> PlainDate;
5811
5812 /// The `add()` method returns a new `Temporal.PlainDate` object with the
5813 /// duration added to this date.
5814 ///
5815 /// # Errors
5816 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
5817 /// field would need constraining.
5818 ///
5819 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/add)
5820 #[wasm_bindgen(method, catch)]
5821 pub fn add(this: &PlainDate, duration: &Duration) -> Result<PlainDate, RangeError>;
5822
5823 /// The `add()` method returns a new `Temporal.PlainDate` object with the
5824 /// duration added to this date.
5825 ///
5826 /// # Errors
5827 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
5828 /// field would need constraining.
5829 ///
5830 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/add)
5831 #[wasm_bindgen(method, js_name = add, catch)]
5832 pub fn add_with_options(
5833 this: &PlainDate,
5834 duration: &Duration,
5835 options: &OverflowOptions,
5836 ) -> Result<PlainDate, RangeError>;
5837
5838 /// The `add()` method taking a duration property bag.
5839 ///
5840 /// # Errors
5841 /// Throws a `TypeError` if no duration field is set; see [`PlainDate::add`] for the remaining errors.
5842 #[wasm_bindgen(method, js_name = add, catch)]
5843 pub fn add_with_duration_like(
5844 this: &PlainDate,
5845 duration: &DurationLike,
5846 ) -> Result<PlainDate, Error>;
5847
5848 /// The `add()` method taking a duration property bag and options; see
5849 /// [`PlainDate::add_with_duration_like`] for errors.
5850 #[wasm_bindgen(method, js_name = add, catch)]
5851 pub fn add_with_duration_like_and_options(
5852 this: &PlainDate,
5853 duration: &DurationLike,
5854 options: &OverflowOptions,
5855 ) -> Result<PlainDate, Error>;
5856
5857 /// The `add()` method taking an ISO 8601 duration string and options; see
5858 /// [`PlainDate::add_with_str`] for errors.
5859 #[wasm_bindgen(method, js_name = add, catch)]
5860 pub fn add_with_str_and_options(
5861 this: &PlainDate,
5862 duration: &str,
5863 options: &OverflowOptions,
5864 ) -> Result<PlainDate, RangeError>;
5865
5866 /// The `add()` method taking an ISO 8601 duration string.
5867 ///
5868 /// # Errors
5869 /// Throws a `RangeError` if the string is not a valid duration; see [`PlainDate::add`] for the remaining errors.
5870 #[wasm_bindgen(method, js_name = add, catch)]
5871 pub fn add_with_str(this: &PlainDate, duration: &str) -> Result<PlainDate, RangeError>;
5872
5873 /// The `subtract()` method returns a new `Temporal.PlainDate` object with the
5874 /// duration subtracted from this date.
5875 ///
5876 /// # Errors
5877 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
5878 /// field would need constraining.
5879 ///
5880 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/subtract)
5881 #[wasm_bindgen(method, catch)]
5882 pub fn subtract(this: &PlainDate, duration: &Duration) -> Result<PlainDate, RangeError>;
5883
5884 /// The `subtract()` method returns a new `Temporal.PlainDate` object with the
5885 /// duration subtracted from this date.
5886 ///
5887 /// # Errors
5888 /// Throws a `RangeError` if the result is out of range, or if `overflow` is `'reject'` and a
5889 /// field would need constraining.
5890 ///
5891 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/subtract)
5892 #[wasm_bindgen(method, js_name = subtract, catch)]
5893 pub fn subtract_with_options(
5894 this: &PlainDate,
5895 duration: &Duration,
5896 options: &OverflowOptions,
5897 ) -> Result<PlainDate, RangeError>;
5898
5899 /// The `subtract()` method taking a duration property bag.
5900 ///
5901 /// # Errors
5902 /// Throws a `TypeError` if no duration field is set; see [`PlainDate::subtract`] for the remaining errors.
5903 #[wasm_bindgen(method, js_name = subtract, catch)]
5904 pub fn subtract_with_duration_like(
5905 this: &PlainDate,
5906 duration: &DurationLike,
5907 ) -> Result<PlainDate, Error>;
5908
5909 /// The `subtract()` method taking a duration property bag and options; see
5910 /// [`PlainDate::subtract_with_duration_like`] for errors.
5911 #[wasm_bindgen(method, js_name = subtract, catch)]
5912 pub fn subtract_with_duration_like_and_options(
5913 this: &PlainDate,
5914 duration: &DurationLike,
5915 options: &OverflowOptions,
5916 ) -> Result<PlainDate, Error>;
5917
5918 /// The `subtract()` method taking an ISO 8601 duration string and options; see
5919 /// [`PlainDate::subtract_with_str`] for errors.
5920 #[wasm_bindgen(method, js_name = subtract, catch)]
5921 pub fn subtract_with_str_and_options(
5922 this: &PlainDate,
5923 duration: &str,
5924 options: &OverflowOptions,
5925 ) -> Result<PlainDate, RangeError>;
5926
5927 /// The `subtract()` method taking an ISO 8601 duration string.
5928 ///
5929 /// # Errors
5930 /// Throws a `RangeError` if the string is not a valid duration; see [`PlainDate::subtract`] for the remaining errors.
5931 #[wasm_bindgen(method, js_name = subtract, catch)]
5932 pub fn subtract_with_str(this: &PlainDate, duration: &str) -> Result<PlainDate, RangeError>;
5933
5934 /// The `until()` method returns a `Temporal.Duration` representing the duration
5935 /// from this date until `other`.
5936 ///
5937 /// # Errors
5938 /// Throws a `RangeError` if dates have different calendars or options are invalid.
5939 ///
5940 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/until)
5941 #[wasm_bindgen(method, catch)]
5942 pub fn until(this: &PlainDate, other: &PlainDate) -> Result<Duration, RangeError>;
5943
5944 /// The `until()` method returns a `Temporal.Duration` representing the duration
5945 /// from this date until `other`.
5946 ///
5947 /// # Errors
5948 /// Throws a `RangeError` if dates have different calendars or options are invalid.
5949 ///
5950 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/until)
5951 #[wasm_bindgen(method, js_name = until, catch)]
5952 pub fn until_with_options(
5953 this: &PlainDate,
5954 other: &PlainDate,
5955 options: &DifferenceOptions,
5956 ) -> Result<Duration, RangeError>;
5957
5958 /// The `since()` method returns a `Temporal.Duration` representing the duration
5959 /// from `other` until this date.
5960 ///
5961 /// # Errors
5962 /// Throws a `RangeError` if dates have different calendars or options are invalid.
5963 ///
5964 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/since)
5965 #[wasm_bindgen(method, catch)]
5966 pub fn since(this: &PlainDate, other: &PlainDate) -> Result<Duration, RangeError>;
5967
5968 /// The `until()` method taking a `Temporal.PlainDateTime`; see [`PlainDate::until`] for errors.
5969 #[wasm_bindgen(method, js_name = until, catch)]
5970 pub fn until_with_plain_date_time(
5971 this: &PlainDate,
5972 other: &PlainDateTime,
5973 ) -> Result<Duration, RangeError>;
5974
5975 /// The `until()` method taking a `Temporal.PlainDateTime` and options; see [`PlainDate::until_with_options`]
5976 /// for errors.
5977 #[wasm_bindgen(method, js_name = until, catch)]
5978 pub fn until_with_plain_date_time_and_options(
5979 this: &PlainDate,
5980 other: &PlainDateTime,
5981 options: &DifferenceOptions,
5982 ) -> Result<Duration, RangeError>;
5983
5984 /// The `until()` method taking a `Temporal.ZonedDateTime`; see [`PlainDate::until`] for errors.
5985 #[wasm_bindgen(method, js_name = until, catch)]
5986 pub fn until_with_zoned_date_time(
5987 this: &PlainDate,
5988 other: &ZonedDateTime,
5989 ) -> Result<Duration, RangeError>;
5990
5991 /// The `until()` method taking a `Temporal.ZonedDateTime` and options; see [`PlainDate::until_with_options`]
5992 /// for errors.
5993 #[wasm_bindgen(method, js_name = until, catch)]
5994 pub fn until_with_zoned_date_time_and_options(
5995 this: &PlainDate,
5996 other: &ZonedDateTime,
5997 options: &DifferenceOptions,
5998 ) -> Result<Duration, RangeError>;
5999
6000 /// The `until()` method taking a property bag; throws a `TypeError` if required fields are missing; see [`PlainDate::until`] for the remaining errors.
6001 #[wasm_bindgen(method, js_name = until, catch)]
6002 pub fn until_with_plain_date_like(
6003 this: &PlainDate,
6004 other: &PlainDateLike,
6005 ) -> Result<Duration, Error>;
6006
6007 /// The `until()` method taking a property bag and options; throws a `TypeError` if required
6008 /// fields are missing. See [`PlainDate::until_with_options`] for the remaining errors.
6009 #[wasm_bindgen(method, js_name = until, catch)]
6010 pub fn until_with_plain_date_like_and_options(
6011 this: &PlainDate,
6012 other: &PlainDateLike,
6013 options: &DifferenceOptions,
6014 ) -> Result<Duration, Error>;
6015
6016 /// The `until()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`PlainDate::until`] for the remaining errors.
6017 #[wasm_bindgen(method, js_name = until, catch)]
6018 pub fn until_with_str(this: &PlainDate, other: &str) -> Result<Duration, RangeError>;
6019
6020 /// The `until()` method taking an ISO 8601 string and options; see [`PlainDate::until_with_options`]
6021 /// for errors.
6022 #[wasm_bindgen(method, js_name = until, catch)]
6023 pub fn until_with_str_and_options(
6024 this: &PlainDate,
6025 other: &str,
6026 options: &DifferenceOptions,
6027 ) -> Result<Duration, RangeError>;
6028
6029 /// The `since()` method returns a `Temporal.Duration` representing the duration
6030 /// from `other` until this date.
6031 ///
6032 /// # Errors
6033 /// Throws a `RangeError` if dates have different calendars or options are invalid.
6034 ///
6035 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/since)
6036 #[wasm_bindgen(method, js_name = since, catch)]
6037 pub fn since_with_options(
6038 this: &PlainDate,
6039 other: &PlainDate,
6040 options: &DifferenceOptions,
6041 ) -> Result<Duration, RangeError>;
6042
6043 /// The `toPlainDateTime()` method returns a `Temporal.PlainDateTime` object representing
6044 /// this date at the given time (or midnight if not provided).
6045 ///
6046 /// # Errors
6047 /// Throws a `RangeError` if the result falls outside the representable range.
6048 ///
6049 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toPlainDateTime)
6050 #[wasm_bindgen(method, js_name = toPlainDateTime, catch)]
6051 pub fn to_plain_date_time(this: &PlainDate) -> Result<PlainDateTime, RangeError>;
6052
6053 /// The `since()` method taking a `Temporal.PlainDateTime`; see [`PlainDate::since`] for errors.
6054 #[wasm_bindgen(method, js_name = since, catch)]
6055 pub fn since_with_plain_date_time(
6056 this: &PlainDate,
6057 other: &PlainDateTime,
6058 ) -> Result<Duration, RangeError>;
6059
6060 /// The `since()` method taking a `Temporal.PlainDateTime` and options; see [`PlainDate::since_with_options`]
6061 /// for errors.
6062 #[wasm_bindgen(method, js_name = since, catch)]
6063 pub fn since_with_plain_date_time_and_options(
6064 this: &PlainDate,
6065 other: &PlainDateTime,
6066 options: &DifferenceOptions,
6067 ) -> Result<Duration, RangeError>;
6068
6069 /// The `since()` method taking a `Temporal.ZonedDateTime`; see [`PlainDate::since`] for errors.
6070 #[wasm_bindgen(method, js_name = since, catch)]
6071 pub fn since_with_zoned_date_time(
6072 this: &PlainDate,
6073 other: &ZonedDateTime,
6074 ) -> Result<Duration, RangeError>;
6075
6076 /// The `since()` method taking a `Temporal.ZonedDateTime` and options; see [`PlainDate::since_with_options`]
6077 /// for errors.
6078 #[wasm_bindgen(method, js_name = since, catch)]
6079 pub fn since_with_zoned_date_time_and_options(
6080 this: &PlainDate,
6081 other: &ZonedDateTime,
6082 options: &DifferenceOptions,
6083 ) -> Result<Duration, RangeError>;
6084
6085 /// The `since()` method taking a property bag; throws a `TypeError` if required fields are missing; see [`PlainDate::since`] for the remaining errors.
6086 #[wasm_bindgen(method, js_name = since, catch)]
6087 pub fn since_with_plain_date_like(
6088 this: &PlainDate,
6089 other: &PlainDateLike,
6090 ) -> Result<Duration, Error>;
6091
6092 /// The `since()` method taking a property bag and options; throws a `TypeError` if required
6093 /// fields are missing. See [`PlainDate::since_with_options`] for the remaining errors.
6094 #[wasm_bindgen(method, js_name = since, catch)]
6095 pub fn since_with_plain_date_like_and_options(
6096 this: &PlainDate,
6097 other: &PlainDateLike,
6098 options: &DifferenceOptions,
6099 ) -> Result<Duration, Error>;
6100
6101 /// The `since()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`PlainDate::since`] for the remaining errors.
6102 #[wasm_bindgen(method, js_name = since, catch)]
6103 pub fn since_with_str(this: &PlainDate, other: &str) -> Result<Duration, RangeError>;
6104
6105 /// The `since()` method taking an ISO 8601 string and options; see [`PlainDate::since_with_options`]
6106 /// for errors.
6107 #[wasm_bindgen(method, js_name = since, catch)]
6108 pub fn since_with_str_and_options(
6109 this: &PlainDate,
6110 other: &str,
6111 options: &DifferenceOptions,
6112 ) -> Result<Duration, RangeError>;
6113
6114 /// The `toPlainDateTime()` method returns a `Temporal.PlainDateTime` object representing
6115 /// this date at the given time (or midnight if not provided).
6116 ///
6117 /// # Errors
6118 /// Throws a `RangeError` if the result falls outside the representable range.
6119 ///
6120 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toPlainDateTime)
6121 #[wasm_bindgen(method, js_name = toPlainDateTime, catch)]
6122 pub fn to_plain_date_time_with_plain_time(
6123 this: &PlainDate,
6124 plain_time: &PlainTime,
6125 ) -> Result<PlainDateTime, RangeError>;
6126
6127 /// The `toZonedDateTime()` method returns a `Temporal.ZonedDateTime` object representing
6128 /// this date at the given time in the given time zone.
6129 ///
6130 /// # Errors
6131 /// Throws a `RangeError` if the time zone identifier is invalid.
6132 ///
6133 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toZonedDateTime)
6134 #[wasm_bindgen(method, js_name = toZonedDateTime, catch)]
6135 pub fn to_zoned_date_time(
6136 this: &PlainDate,
6137 time_zone: &str,
6138 ) -> Result<ZonedDateTime, RangeError>;
6139
6140 /// The `toPlainDateTime()` method taking an ISO 8601 string; throws a `RangeError` if the string is invalid; see [`PlainDate::to_plain_date_time`] for the remaining errors.
6141 #[wasm_bindgen(method, js_name = toPlainDateTime, catch)]
6142 pub fn to_plain_date_time_with_str(
6143 this: &PlainDate,
6144 plain_time: &str,
6145 ) -> Result<PlainDateTime, RangeError>;
6146
6147 /// The `toPlainDateTime()` method taking a property bag; throws a `TypeError` if no time field is present; see [`PlainDate::to_plain_date_time`] for the remaining errors.
6148 #[wasm_bindgen(method, js_name = toPlainDateTime, catch)]
6149 pub fn to_plain_date_time_with_plain_time_like(
6150 this: &PlainDate,
6151 plain_time: &PlainTimeLike,
6152 ) -> Result<PlainDateTime, Error>;
6153
6154 /// The `toPlainDateTime()` method taking a `Temporal.PlainDateTime`; see [`PlainDate::to_plain_date_time`] for errors.
6155 #[wasm_bindgen(method, js_name = toPlainDateTime, catch)]
6156 pub fn to_plain_date_time_with_plain_date_time(
6157 this: &PlainDate,
6158 plain_time: &PlainDateTime,
6159 ) -> Result<PlainDateTime, RangeError>;
6160
6161 /// The `toPlainDateTime()` method taking a `Temporal.ZonedDateTime`; see [`PlainDate::to_plain_date_time`] for errors.
6162 #[wasm_bindgen(method, js_name = toPlainDateTime, catch)]
6163 pub fn to_plain_date_time_with_zoned_date_time(
6164 this: &PlainDate,
6165 plain_time: &ZonedDateTime,
6166 ) -> Result<PlainDateTime, RangeError>;
6167
6168 /// The `toZonedDateTime()` method in the time zone of the given
6169 /// `Temporal.ZonedDateTime`; see [`PlainDate::to_zoned_date_time`] for errors.
6170 #[wasm_bindgen(method, js_name = toZonedDateTime, catch)]
6171 pub fn to_zoned_date_time_with_zoned_date_time(
6172 this: &PlainDate,
6173 time_zone: &ZonedDateTime,
6174 ) -> Result<ZonedDateTime, RangeError>;
6175
6176 /// The `toZonedDateTime()` method returns a `Temporal.ZonedDateTime` object representing
6177 /// this date at the given time in the given time zone.
6178 ///
6179 /// # Errors
6180 /// Throws a `RangeError` if the time zone identifier is invalid.
6181 /// Throws a `TypeError` if `plainTime` is a property bag with no time fields.
6182 ///
6183 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toZonedDateTime)
6184 #[wasm_bindgen(method, js_name = toZonedDateTime, catch)]
6185 pub fn to_zoned_date_time_with_to_zoned_date_time_item(
6186 this: &PlainDate,
6187 item: &ToZonedDateTimeItem,
6188 ) -> Result<ZonedDateTime, Error>;
6189
6190 /// The `toPlainYearMonth()` method returns a `Temporal.PlainYearMonth` object representing
6191 /// the year and month of this date.
6192 ///
6193 /// # Errors
6194 /// Throws a `RangeError` if the first day of this date's calendar month falls
6195 /// before the representable range, which can happen for non-ISO calendars at
6196 /// the lower limit.
6197 ///
6198 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toPlainYearMonth)
6199 #[wasm_bindgen(method, js_name = toPlainYearMonth, catch)]
6200 pub fn to_plain_year_month(this: &PlainDate) -> Result<PlainYearMonth, RangeError>;
6201
6202 /// The `toPlainMonthDay()` method returns a `Temporal.PlainMonthDay` object representing
6203 /// the month and day of this date.
6204 ///
6205 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toPlainMonthDay)
6206 #[wasm_bindgen(method, js_name = toPlainMonthDay)]
6207 pub fn to_plain_month_day(this: &PlainDate) -> PlainMonthDay;
6208
6209 /// The `toLocaleString()` method returns a language-sensitive string representation
6210 /// of this date.
6211 ///
6212 /// # Errors
6213 /// Throws a `RangeError` if `locales` is invalid or the locale's calendar does
6214 /// not match this value's calendar.
6215 ///
6216 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toLocaleString)
6217 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
6218 pub fn to_locale_string(this: &PlainDate) -> Result<JsString, RangeError>;
6219
6220 /// The `toLocaleString()` method; see [`PlainDate::to_locale_string`] for errors.
6221 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
6222 pub fn to_locale_string_with_str(
6223 this: &PlainDate,
6224 locales: &str,
6225 ) -> Result<JsString, RangeError>;
6226
6227 /// The `toLocaleString()` method; see [`PlainDate::to_locale_string`] for errors.
6228 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
6229 pub fn to_locale_string_with_str_sequence(
6230 this: &PlainDate,
6231 locales: &[JsString],
6232 ) -> Result<JsString, RangeError>;
6233
6234 /// The `toLocaleString()` method with options; throws a `TypeError` if an option does not
6235 /// apply to this type or conflicts with another. See [`PlainDate::to_locale_string`] for the
6236 /// remaining errors.
6237 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
6238 pub fn to_locale_string_with_str_sequence_and_options(
6239 this: &PlainDate,
6240 locales: &[JsString],
6241 options: &Intl::DateTimeFormatOptions,
6242 ) -> Result<JsString, Error>;
6243
6244 /// The `toLocaleString()` method with options; `None` for `locales` uses the default locale.
6245 /// Throws a `TypeError` if an option does not apply to this type or conflicts with another.
6246 /// See [`PlainDate::to_locale_string`] for the remaining errors.
6247 #[wasm_bindgen(method, js_name = toLocaleString, catch)]
6248 pub fn to_locale_string_with_options(
6249 this: &PlainDate,
6250 locales: Option<&str>,
6251 options: &Intl::DateTimeFormatOptions,
6252 ) -> Result<JsString, Error>;
6253
6254 /// The `toJSON()` method returns a string representation of this date
6255 /// suitable for JSON serialization.
6256 ///
6257 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toJSON)
6258 #[wasm_bindgen(method, js_name = toJSON)]
6259 pub fn to_json(this: &PlainDate) -> JsString;
6260
6261 /// The `toString()` method returns an RFC 9557 string representation of this date.
6262 ///
6263 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toString)
6264 #[wasm_bindgen(method, js_name = toString)]
6265 pub fn to_js_string(this: &PlainDate) -> JsString;
6266
6267 /// The `toString()` method returns an RFC 9557 string representation of this date,
6268 /// formatted according to `options`.
6269 ///
6270 /// # Errors
6271 /// Throws a `RangeError` if the options are invalid for this type.
6272 ///
6273 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/toString)
6274 #[wasm_bindgen(method, js_name = toString, catch)]
6275 pub fn to_js_string_with_options(
6276 this: &PlainDate,
6277 options: &ShowCalendarOptions,
6278 ) -> Result<JsString, RangeError>;
6279}
6280
6281/// The `Temporal.Now` object has several methods which give information about
6282/// the current date, time, and time zone.
6283///
6284/// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now)
6285pub mod Now {
6286 use super::*;
6287
6288 #[wasm_bindgen]
6289 extern "C" {
6290 /// The `Temporal.Now.instant()` static method returns the current exact time
6291 /// as a `Temporal.Instant`.
6292 ///
6293 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/instant)
6294 #[wasm_bindgen(js_namespace = ["Temporal", "Now"])]
6295 pub fn instant() -> Instant;
6296
6297 /// The `Temporal.Now.timeZoneId()` static method returns the identifier of
6298 /// the system's current time zone.
6299 ///
6300 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/timeZoneId)
6301 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = timeZoneId)]
6302 pub fn time_zone_id() -> JsString;
6303
6304 /// The `Temporal.Now.zonedDateTimeISO()` static method returns the current date and time as a
6305 /// `Temporal.ZonedDateTime` in the ISO 8601 calendar and
6306 /// the system's current time zone.
6307 ///
6308 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/zonedDateTimeISO)
6309 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = zonedDateTimeISO)]
6310 pub fn zoned_date_time_iso() -> ZonedDateTime;
6311
6312 /// The `Temporal.Now.zonedDateTimeISO()` static method returns the current date and time as a
6313 /// `Temporal.ZonedDateTime` in the ISO 8601 calendar and
6314 /// the given time zone.
6315 ///
6316 /// # Errors
6317 /// Throws a `RangeError` if `time_zone` is not a valid time zone identifier.
6318 ///
6319 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/zonedDateTimeISO)
6320 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = zonedDateTimeISO, catch)]
6321 pub fn zoned_date_time_iso_with_time_zone(
6322 time_zone: &str,
6323 ) -> Result<ZonedDateTime, RangeError>;
6324
6325 /// `Temporal.Now.zonedDateTimeISO()` in the time zone of the given `Temporal.ZonedDateTime`.
6326 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = zonedDateTimeISO)]
6327 pub fn zoned_date_time_iso_with_zoned_date_time(time_zone: &ZonedDateTime)
6328 -> ZonedDateTime;
6329
6330 /// The `Temporal.Now.plainDateTimeISO()` static method returns the current date and wall-clock time
6331 /// as a `Temporal.PlainDateTime` in the ISO 8601 calendar and
6332 /// the system's current time zone.
6333 ///
6334 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/plainDateTimeISO)
6335 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainDateTimeISO)]
6336 pub fn plain_date_time_iso() -> PlainDateTime;
6337
6338 /// The `Temporal.Now.plainDateTimeISO()` static method returns the current date and wall-clock time
6339 /// as a `Temporal.PlainDateTime` in the ISO 8601 calendar and
6340 /// the given time zone.
6341 ///
6342 /// # Errors
6343 /// Throws a `RangeError` if `time_zone` is not a valid time zone identifier.
6344 ///
6345 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/plainDateTimeISO)
6346 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainDateTimeISO, catch)]
6347 pub fn plain_date_time_iso_with_time_zone(
6348 time_zone: &str,
6349 ) -> Result<PlainDateTime, RangeError>;
6350
6351 /// `Temporal.Now.plainDateTimeISO()` in the time zone of the given `Temporal.ZonedDateTime`.
6352 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainDateTimeISO)]
6353 pub fn plain_date_time_iso_with_zoned_date_time(time_zone: &ZonedDateTime)
6354 -> PlainDateTime;
6355
6356 /// The `Temporal.Now.plainDateISO()` static method returns the current date as a `Temporal.PlainDate`
6357 /// in the ISO 8601 calendar and
6358 /// the system's current time zone.
6359 ///
6360 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/plainDateISO)
6361 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainDateISO)]
6362 pub fn plain_date_iso() -> PlainDate;
6363
6364 /// The `Temporal.Now.plainDateISO()` static method returns the current date as a `Temporal.PlainDate`
6365 /// in the ISO 8601 calendar and
6366 /// the given time zone.
6367 ///
6368 /// # Errors
6369 /// Throws a `RangeError` if `time_zone` is not a valid time zone identifier.
6370 ///
6371 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/plainDateISO)
6372 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainDateISO, catch)]
6373 pub fn plain_date_iso_with_time_zone(time_zone: &str) -> Result<PlainDate, RangeError>;
6374
6375 /// `Temporal.Now.plainDateISO()` in the time zone of the given `Temporal.ZonedDateTime`.
6376 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainDateISO)]
6377 pub fn plain_date_iso_with_zoned_date_time(time_zone: &ZonedDateTime) -> PlainDate;
6378
6379 /// The `Temporal.Now.plainTimeISO()` static method returns the current wall-clock time as a
6380 /// `Temporal.PlainTime`
6381 /// in the system's current time zone.
6382 ///
6383 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/plainTimeISO)
6384 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainTimeISO)]
6385 pub fn plain_time_iso() -> PlainTime;
6386
6387 /// The `Temporal.Now.plainTimeISO()` static method returns the current wall-clock time as a
6388 /// `Temporal.PlainTime`
6389 /// in the given time zone.
6390 ///
6391 /// # Errors
6392 /// Throws a `RangeError` if `time_zone` is not a valid time zone identifier.
6393 ///
6394 /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Now/plainTimeISO)
6395 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainTimeISO, catch)]
6396 pub fn plain_time_iso_with_time_zone(time_zone: &str) -> Result<PlainTime, RangeError>;
6397
6398 /// `Temporal.Now.plainTimeISO()` in the time zone of the given `Temporal.ZonedDateTime`.
6399 #[wasm_bindgen(js_namespace = ["Temporal", "Now"], js_name = plainTimeISO)]
6400 pub fn plain_time_iso_with_zoned_date_time(time_zone: &ZonedDateTime) -> PlainTime;
6401 }
6402}