Struct temporal_rs::components::DateTime
source · #[non_exhaustive]pub struct DateTime<C: CalendarProtocol> { /* private fields */ }
Expand description
The native Rust implementation of Temporal.PlainDateTime
Implementations§
source§impl<C: CalendarProtocol> DateTime<C>
impl<C: CalendarProtocol> DateTime<C>
sourcepub fn new(
year: i32,
month: i32,
day: i32,
hour: i32,
minute: i32,
second: i32,
millisecond: i32,
microsecond: i32,
nanosecond: i32,
calendar: CalendarSlot<C>
) -> TemporalResult<Self>
pub fn new( year: i32, month: i32, day: i32, hour: i32, minute: i32, second: i32, millisecond: i32, microsecond: i32, nanosecond: i32, calendar: CalendarSlot<C> ) -> TemporalResult<Self>
Creates a new validated DateTime
.
sourcepub fn validate<T: IsoDateSlots>(target: &T) -> bool
pub fn validate<T: IsoDateSlots>(target: &T) -> bool
Validates whether ISO date slots are within iso limits at noon.
sourcepub fn millisecond(&self) -> u16
pub fn millisecond(&self) -> u16
Returns the millisecond
value
sourcepub fn microsecond(&self) -> u16
pub fn microsecond(&self) -> u16
Returns the microsecond
value
sourcepub fn nanosecond(&self) -> u16
pub fn nanosecond(&self) -> u16
Returns the nanosecond
value
sourcepub fn calendar(&self) -> &CalendarSlot<C>
pub fn calendar(&self) -> &CalendarSlot<C>
Returns the Calendar value.
source§impl DateTime<()>
impl DateTime<()>
sourcepub fn year(&self) -> TemporalResult<i32>
pub fn year(&self) -> TemporalResult<i32>
Returns the calendar year value.
sourcepub fn month(&self) -> TemporalResult<u8>
pub fn month(&self) -> TemporalResult<u8>
Returns the calendar month value.
sourcepub fn month_code(&self) -> TemporalResult<TinyAsciiStr<4>>
pub fn month_code(&self) -> TemporalResult<TinyAsciiStr<4>>
Returns the calendar month code value.
sourcepub fn day(&self) -> TemporalResult<u8>
pub fn day(&self) -> TemporalResult<u8>
Returns the calendar day value.
sourcepub fn day_of_week(&self) -> TemporalResult<u16>
pub fn day_of_week(&self) -> TemporalResult<u16>
Returns the calendar day of week value.
sourcepub fn day_of_year(&self) -> TemporalResult<u16>
pub fn day_of_year(&self) -> TemporalResult<u16>
Returns the calendar day of year value.
sourcepub fn week_of_year(&self) -> TemporalResult<u16>
pub fn week_of_year(&self) -> TemporalResult<u16>
Returns the calendar week of year value.
sourcepub fn year_of_week(&self) -> TemporalResult<i32>
pub fn year_of_week(&self) -> TemporalResult<i32>
Returns the calendar year of week value.
sourcepub fn days_in_week(&self) -> TemporalResult<u16>
pub fn days_in_week(&self) -> TemporalResult<u16>
Returns the calendar days in week value.
sourcepub fn days_in_month(&self) -> TemporalResult<u16>
pub fn days_in_month(&self) -> TemporalResult<u16>
Returns the calendar days in month value.
sourcepub fn days_in_year(&self) -> TemporalResult<u16>
pub fn days_in_year(&self) -> TemporalResult<u16>
Returns the calendar days in year value.
sourcepub fn months_in_year(&self) -> TemporalResult<u16>
pub fn months_in_year(&self) -> TemporalResult<u16>
Returns the calendar months in year value.
sourcepub fn in_leap_year(&self) -> TemporalResult<bool>
pub fn in_leap_year(&self) -> TemporalResult<bool>
Returns returns whether the date in a leap year for the given calendar.
source§impl<C: CalendarProtocol> DateTime<C>
impl<C: CalendarProtocol> DateTime<C>
sourcepub fn contextual_year(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<i32>
pub fn contextual_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<i32>
Returns the calendar year value with provided context.
sourcepub fn contextual_month(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u8>
pub fn contextual_month( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u8>
Returns the calendar month value with provided context.
sourcepub fn contextual_month_code(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<TinyAsciiStr<4>>
pub fn contextual_month_code( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<TinyAsciiStr<4>>
Returns the calendar month code value with provided context.
sourcepub fn contextual_day(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u8>
pub fn contextual_day( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u8>
Returns the calendar day value with provided context.
sourcepub fn contextual_day_of_week(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u16>
pub fn contextual_day_of_week( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>
Returns the calendar day of week value with provided context.
sourcepub fn contextual_day_of_year(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u16>
pub fn contextual_day_of_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>
Returns the calendar day of year value with provided context.
sourcepub fn contextual_week_of_year(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u16>
pub fn contextual_week_of_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>
Returns the calendar week of year value with provided context.
sourcepub fn contextual_year_of_week(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<i32>
pub fn contextual_year_of_week( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<i32>
Returns the calendar year of week value with provided context.
sourcepub fn contextual_days_in_week(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u16>
pub fn contextual_days_in_week( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>
Returns the calendar days in week value with provided context.
sourcepub fn contextual_days_in_month(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u16>
pub fn contextual_days_in_month( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>
Returns the calendar days in month value with provided context.
sourcepub fn contextual_days_in_year(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u16>
pub fn contextual_days_in_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>
Returns the calendar days in year value with provided context.
sourcepub fn contextual_months_in_year(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<u16>
pub fn contextual_months_in_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>
Returns the calendar months in year value with provided context.
sourcepub fn contextual_in_leap_year(
this: &C::DateTime,
context: &mut C::Context
) -> TemporalResult<bool>
pub fn contextual_in_leap_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<bool>
Returns whether the date is in a leap year for the given calendar with provided context.
Trait Implementations§
source§impl<C: CalendarProtocol> FromStr for DateTime<C>
impl<C: CalendarProtocol> FromStr for DateTime<C>
source§impl<C: CalendarProtocol> GetCalendarSlot<C> for DateTime<C>
impl<C: CalendarProtocol> GetCalendarSlot<C> for DateTime<C>
source§fn get_calendar(&self) -> CalendarSlot<C>
fn get_calendar(&self) -> CalendarSlot<C>
CalendarSlot<C>
value of the implementor.