#[repr(transparent)]pub struct Date(pub Date<Arc<AnyCalendar>>);Expand description
An ICU4X Date object capable of containing a date for any calendar.
Tuple Fields§
§0: Date<Arc<AnyCalendar>>Implementations§
Source§impl<'transparent_convert_outer> Date
impl<'transparent_convert_outer> Date
pub(crate) fn transparent_convert( from: &'transparent_convert_outer Date<Arc<AnyCalendar>>, ) -> &'transparent_convert_outer Self
Source§impl Date
impl Date
Sourcepub fn from_iso_in_calendar(
iso_year: i32,
iso_month: u8,
iso_day: u8,
calendar: &Calendar,
) -> Result<Box<Date>, CalendarError>
pub fn from_iso_in_calendar( iso_year: i32, iso_month: u8, iso_day: u8, calendar: &Calendar, ) -> Result<Box<Date>, CalendarError>
Creates a new Date representing the ISO date
given but in a given calendar
Sourcepub fn from_codes_in_calendar(
era_code: &DiplomatStr,
year: i32,
month_code: &DiplomatStr,
day: u8,
calendar: &Calendar,
) -> Result<Box<Date>, CalendarError>
pub fn from_codes_in_calendar( era_code: &DiplomatStr, year: i32, month_code: &DiplomatStr, day: u8, calendar: &Calendar, ) -> Result<Box<Date>, CalendarError>
Creates a new Date from the given codes, which are interpreted in the given calendar system
An empty era code will treat the year as an extended year
Sourcepub fn from_rata_die(
rd: i64,
calendar: &Calendar,
) -> Result<Box<Date>, CalendarError>
pub fn from_rata_die( rd: i64, calendar: &Calendar, ) -> Result<Box<Date>, CalendarError>
Creates a new Date from the given Rata Die
Sourcepub fn from_string(
v: &DiplomatStr,
calendar: &Calendar,
) -> Result<Box<Date>, Rfc9557ParseError>
pub fn from_string( v: &DiplomatStr, calendar: &Calendar, ) -> Result<Box<Date>, Rfc9557ParseError>
Creates a new Date from an IXDTF string.
Sourcepub fn to_calendar(&self, calendar: &Calendar) -> Box<Date>
pub fn to_calendar(&self, calendar: &Calendar) -> Box<Date>
Convert this date to one in a different calendar
Sourcepub fn to_rata_die(&self) -> i64
pub fn to_rata_die(&self) -> i64
Returns this date’s Rata Die
Sourcepub fn day_of_year(&self) -> u16
pub fn day_of_year(&self) -> u16
Returns the 1-indexed day in the year for this date
Sourcepub fn day_of_month(&self) -> u8
pub fn day_of_month(&self) -> u8
Returns the 1-indexed day in the month for this date
Sourcepub fn day_of_week(&self) -> Weekday
pub fn day_of_week(&self) -> Weekday
Returns the day in the week for this day
Sourcepub fn ordinal_month(&self) -> u8
pub fn ordinal_month(&self) -> u8
Returns 1-indexed number of the month of this date in its year
Note that for lunar calendars this may not lead to the same month having the same ordinal month across years; use month_code if you care about month identity.
Sourcepub fn month_code(&self, write: &mut DiplomatWrite)
pub fn month_code(&self, write: &mut DiplomatWrite)
Returns the month code for this date. Typically something like “M01”, “M02”, but can be more complicated for lunar calendars.
Sourcepub fn month_number(&self) -> u8
pub fn month_number(&self) -> u8
Returns the month number of this month.
Sourcepub fn month_is_leap(&self) -> bool
pub fn month_is_leap(&self) -> bool
Returns whether the month is a leap month.
Returns the year number in the current era for this date
For calendars without an era, returns the related ISO year.
Sourcepub fn extended_year(&self) -> i32
pub fn extended_year(&self) -> i32
Returns the extended year, which can be used for
This year number can be used when you need a simple numeric representation of the year, and can be meaningfully compared with extended years from other eras or used in arithmetic.
Sourcepub fn era(&self, write: &mut DiplomatWrite)
pub fn era(&self, write: &mut DiplomatWrite)
Returns the era for this date, or an empty string
Sourcepub fn months_in_year(&self) -> u8
pub fn months_in_year(&self) -> u8
Returns the number of months in the year represented by this date
Sourcepub fn days_in_month(&self) -> u8
pub fn days_in_month(&self) -> u8
Returns the number of days in the month represented by this date
Sourcepub fn days_in_year(&self) -> u16
pub fn days_in_year(&self) -> u16
Returns the number of days in the year represented by this date