GregorianCalendar
struct · ferroui-base · v0.5.0
struct GregorianCalendar
The proleptic Gregorian calendar. It has no state.
Members
newmin_supported_date_timemax_supported_date_timetry_add_daysadd_daystry_add_monthsadd_monthstry_add_yearsadd_yearsget_day_of_weekget_days_in_monthget_week_of_year
new
const fn new() -> GregorianCalendar
Creates the calendar.
min_supported_date_time
const fn min_supported_date_time(self: &Self) -> DateTime
The earliest date the calendar supports.
max_supported_date_time
const fn max_supported_date_time(self: &Self) -> DateTime
The latest date the calendar supports.
try_add_days
fn try_add_days(self: &Self, time: DateTime, days: i32) -> Option<DateTime>
time moved by a number of days; None when the result is out of
range (.NET throws ArgumentException).
add_days
fn add_days(self: &Self, time: DateTime, days: i32) -> DateTime
time moved by a number of days. Panics when the result is out of range.
try_add_months
fn try_add_months(self: &Self, time: DateTime, months: i32) -> Option<DateTime>
time moved by a number of months, keeping the day where the
resulting month has it; None when months is not in
-120000..=120000 or the result is out of range.
add_months
fn add_months(self: &Self, time: DateTime, months: i32) -> DateTime
time moved by a number of months. Panics when out of range.
try_add_years
fn try_add_years(self: &Self, time: DateTime, years: i32) -> Option<DateTime>
time moved by a number of years; None when the result is out of range.
add_years
fn add_years(self: &Self, time: DateTime, years: i32) -> DateTime
time moved by a number of years. Panics when out of range.
get_day_of_week
fn get_day_of_week(self: &Self, time: DateTime) -> DayOfWeek
The day of the week of time.
get_days_in_month
fn get_days_in_month(self: &Self, year: i32, month: i32) -> i32
The number of days of a month. Panics for an invalid year or month.
get_week_of_year
fn get_week_of_year(self: &Self, time: DateTime, rule: CalendarWeekRule, first_day_of_week: DayOfWeek) -> i32
The number of the week of the year that contains time, counted from
one, for the given rule and first day of the week.
As in .NET, the last days of December are never counted into the first
week of the following year: they get the number 53 (or 52) even where
ISO 8601 says 1. Use IsoWeek::get_week_of_year for ISO numbers.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeResourceKeyObjectPropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherCloneCopyDebugDefaultStructuralPartialEqPartialEqEqHash
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.