Trait icu_calendar::Calendar
source · [−]pub trait Calendar {
type DateInner: PartialEq + Eq + Clone + Debug;
Show 13 methods
fn date_from_iso(&self, iso: Date<Iso>) -> Self::DateInner;
fn date_to_iso(&self, date: &Self::DateInner) -> Date<Iso>;
fn months_in_year(&self, date: &Self::DateInner) -> u8;
fn days_in_year(&self, date: &Self::DateInner) -> u32;
fn days_in_month(&self, date: &Self::DateInner) -> u8;
fn offset_date(
&self,
date: &mut Self::DateInner,
offset: DateDuration<Self>
);
fn until(
&self,
date1: &Self::DateInner,
date2: &Self::DateInner,
largest_unit: DateDurationUnit,
smallest_unit: DateDurationUnit
) -> DateDuration<Self>;
fn debug_name() -> &'static str;
fn year(&self, date: &Self::DateInner) -> Year;
fn month(&self, date: &Self::DateInner) -> Month;
fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth;
fn day_of_year_info(&self, date: &Self::DateInner) -> DayOfYearInfo;
fn day_of_week(&self, date: &Self::DateInner) -> IsoWeekday { ... }
}
Expand description
Associated Types
Required methods
fn date_from_iso(&self, iso: Date<Iso>) -> Self::DateInner
fn date_from_iso(&self, iso: Date<Iso>) -> Self::DateInner
Construct the date from an ISO date
fn date_to_iso(&self, date: &Self::DateInner) -> Date<Iso>
fn date_to_iso(&self, date: &Self::DateInner) -> Date<Iso>
Obtain an ISO date from this date
fn months_in_year(&self, date: &Self::DateInner) -> u8
fn months_in_year(&self, date: &Self::DateInner) -> u8
Count the number of months in a given year, specified by providing a date from that year
fn days_in_year(&self, date: &Self::DateInner) -> u32
fn days_in_year(&self, date: &Self::DateInner) -> u32
Count the number of days in a given year, specified by providing a date from that year
fn days_in_month(&self, date: &Self::DateInner) -> u8
fn days_in_month(&self, date: &Self::DateInner) -> u8
Count the number of days in a given month, specified by providing a date from that year/month
fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration<Self>)
fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration<Self>)
Add offset
to date
fn until(
&self,
date1: &Self::DateInner,
date2: &Self::DateInner,
largest_unit: DateDurationUnit,
smallest_unit: DateDurationUnit
) -> DateDuration<Self>
fn until(
&self,
date1: &Self::DateInner,
date2: &Self::DateInner,
largest_unit: DateDurationUnit,
smallest_unit: DateDurationUnit
) -> DateDuration<Self>
Calculate date2 - date
as a duration
fn debug_name() -> &'static str
fn debug_name() -> &'static str
Obtain a name for the calendar for debug printing
The calendar-specific month represented by date
fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
The calendar-specific day-of-month represented by date
fn day_of_year_info(&self, date: &Self::DateInner) -> DayOfYearInfo
fn day_of_year_info(&self, date: &Self::DateInner) -> DayOfYearInfo
Information of the day of the year
Provided methods
fn day_of_week(&self, date: &Self::DateInner) -> IsoWeekday
fn day_of_week(&self, date: &Self::DateInner) -> IsoWeekday
Calculate the day of the week and return it