@@ -536,7 +536,7 @@ impl Calendar {
536536 early_constrain_date_duration ( & duration) ?;
537537 let mut options = DateAddOptions :: default ( ) ;
538538 options. overflow = Some ( overflow. into ( ) ) ;
539- let calendar_date = self . 0 . from_iso ( * date. to_icu4x ( ) . inner ( ) ) ;
539+ let calendar_date = self . 0 . from_rata_die ( date. to_rd ( ) ) ;
540540
541541 let added = self . 0 . add ( & calendar_date, duration, options) ?;
542542
@@ -563,8 +563,8 @@ impl Calendar {
563563 }
564564 let mut options = DateDifferenceOptions :: default ( ) ;
565565 options. largest_unit = Some ( largest_unit. try_into ( ) ?) ;
566- let calendar_date1 = self . 0 . from_iso ( * one. to_icu4x ( ) . inner ( ) ) ;
567- let calendar_date2 = self . 0 . from_iso ( * two. to_icu4x ( ) . inner ( ) ) ;
566+ let calendar_date1 = self . 0 . from_rata_die ( one. to_rd ( ) ) ;
567+ let calendar_date2 = self . 0 . from_rata_die ( two. to_rd ( ) ) ;
568568
569569 let added = self . 0 . until ( & calendar_date1, & calendar_date2, options) ;
570570
@@ -590,7 +590,7 @@ impl Calendar {
590590 if self . is_iso ( ) {
591591 return None ;
592592 }
593- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
593+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
594594 self . 0
595595 . year_info ( & calendar_date)
596596 . era ( )
@@ -602,7 +602,7 @@ impl Calendar {
602602 if self . is_iso ( ) {
603603 return None ;
604604 }
605- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
605+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
606606 self . 0
607607 . year_info ( & calendar_date)
608608 . era ( )
@@ -614,7 +614,7 @@ impl Calendar {
614614 if self . is_iso ( ) {
615615 return iso_date. year ;
616616 }
617- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
617+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
618618 self . 0 . extended_year ( & calendar_date)
619619 }
620620
@@ -623,17 +623,13 @@ impl Calendar {
623623 if self . is_iso ( ) {
624624 return iso_date. month ;
625625 }
626- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
626+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
627627 self . 0 . month ( & calendar_date) . ordinal
628628 }
629629
630630 /// `CalendarMonthCode`
631631 pub fn month_code ( & self , iso_date : & IsoDate ) -> MonthCode {
632- if self . is_iso ( ) {
633- let mc = iso_date. to_icu4x ( ) . month ( ) . to_input ( ) . code ( ) . 0 ;
634- return MonthCode ( mc) ;
635- }
636- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
632+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
637633 MonthCode ( self . 0 . month ( & calendar_date) . to_input ( ) . code ( ) . 0 )
638634 }
639635
@@ -642,28 +638,25 @@ impl Calendar {
642638 if self . is_iso ( ) {
643639 return iso_date. day ;
644640 }
645- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
641+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
646642 self . 0 . day_of_month ( & calendar_date) . 0
647643 }
648644
649645 /// `CalendarDayOfWeek`
650646 pub fn day_of_week ( & self , iso_date : & IsoDate ) -> u16 {
651- iso_date. to_icu4x ( ) . weekday ( ) as u16
647+ iso_date. to_icu4x_iso ( ) . weekday ( ) as u16
652648 }
653649
654650 /// `CalendarDayOfYear`
655651 pub fn day_of_year ( & self , iso_date : & IsoDate ) -> u16 {
656- if self . is_iso ( ) {
657- return iso_date. to_icu4x ( ) . day_of_year ( ) . 0 ;
658- }
659- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
652+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
660653 self . 0 . day_of_year ( & calendar_date) . 0
661654 }
662655
663656 /// `CalendarWeekOfYear`
664657 pub fn week_of_year ( & self , iso_date : & IsoDate ) -> Option < u8 > {
665658 if self . is_iso ( ) {
666- return Some ( iso_date. to_icu4x ( ) . week_of_year ( ) . week_number ) ;
659+ return Some ( iso_date. to_icu4x_iso ( ) . week_of_year ( ) . week_number ) ;
667660 }
668661 // TODO: Research in ICU4X and determine best approach.
669662 None
@@ -672,7 +665,7 @@ impl Calendar {
672665 /// `CalendarYearOfWeek`
673666 pub fn year_of_week ( & self , iso_date : & IsoDate ) -> Option < i32 > {
674667 if self . is_iso ( ) {
675- return Some ( iso_date. to_icu4x ( ) . week_of_year ( ) . iso_year ) ;
668+ return Some ( iso_date. to_icu4x_iso ( ) . week_of_year ( ) . iso_year ) ;
676669 }
677670 // TODO: Research in ICU4X and determine best approach.
678671 None
@@ -685,19 +678,13 @@ impl Calendar {
685678
686679 /// `CalendarDaysInMonth`
687680 pub fn days_in_month ( & self , iso_date : & IsoDate ) -> u16 {
688- if self . is_iso ( ) {
689- return iso_date. to_icu4x ( ) . days_in_month ( ) as u16 ;
690- }
691- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
681+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
692682 self . 0 . days_in_month ( & calendar_date) as u16
693683 }
694684
695685 /// `CalendarDaysInYear`
696686 pub fn days_in_year ( & self , iso_date : & IsoDate ) -> u16 {
697- if self . is_iso ( ) {
698- return iso_date. to_icu4x ( ) . days_in_year ( ) ;
699- }
700- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
687+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
701688 self . 0 . days_in_year ( & calendar_date)
702689 }
703690
@@ -706,16 +693,13 @@ impl Calendar {
706693 if self . is_iso ( ) {
707694 return 12 ;
708695 }
709- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
696+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
710697 self . 0 . months_in_year ( & calendar_date) as u16
711698 }
712699
713700 /// `CalendarInLeapYear`
714701 pub fn in_leap_year ( & self , iso_date : & IsoDate ) -> bool {
715- if self . is_iso ( ) {
716- return iso_date. to_icu4x ( ) . is_in_leap_year ( ) ;
717- }
718- let calendar_date = self . 0 . from_iso ( * iso_date. to_icu4x ( ) . inner ( ) ) ;
702+ let calendar_date = self . 0 . from_rata_die ( iso_date. to_rd ( ) ) ;
719703 self . 0 . is_in_leap_year ( & calendar_date)
720704 }
721705
0 commit comments