pub struct PlainDate { /* private fields */ }Expand description
A Temporal.PlainDate represents a calendar date without time or time zone information.
For example, it could be used to represent an event on a calendar which happens during
the whole day no matter which time zone it’s happening in.
Implementations§
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Sourcepub fn new_with_calendar(
iso_year: i32,
iso_month: u32,
iso_day: u32,
calendar: &str,
) -> Result<PlainDate, RangeError>
pub fn new_with_calendar( iso_year: i32, iso_month: u32, iso_day: u32, calendar: &str, ) -> Result<PlainDate, RangeError>
The Temporal.PlainDate() constructor creates Temporal.PlainDate objects
in the given calendar.
§Errors
Throws a RangeError if any field is out of range.
Throws a RangeError if calendar is not a supported calendar identifier.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_str(item: &str) -> Result<PlainDate, RangeError>
pub fn from_with_str(item: &str) -> Result<PlainDate, RangeError>
The Temporal.PlainDate.from() static method creates a new Temporal.PlainDate
object from another value.
§Errors
Throws a RangeError if the string is invalid or values are out of range
(when overflow is 'reject').
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_str_and_options(
item: &str,
options: &OverflowOptions,
) -> Result<PlainDate, RangeError>
pub fn from_with_str_and_options( item: &str, options: &OverflowOptions, ) -> Result<PlainDate, RangeError>
The Temporal.PlainDate.from() static method; see PlainDate::from_with_str for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_plain_date_like(
item: &PlainDateLike,
) -> Result<PlainDate, Error>
pub fn from_with_plain_date_like( item: &PlainDateLike, ) -> Result<PlainDate, Error>
The Temporal.PlainDate.from() static method taking a property bag; throws a TypeError if
required fields are missing. See PlainDate::from_with_str for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_plain_date_like_and_options(
item: &PlainDateLike,
options: &OverflowOptions,
) -> Result<PlainDate, Error>
pub fn from_with_plain_date_like_and_options( item: &PlainDateLike, options: &OverflowOptions, ) -> Result<PlainDate, Error>
The Temporal.PlainDate.from() static method taking a property bag; throws a TypeError if
required fields are missing. See PlainDate::from_with_str for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_plain_date(item: &PlainDate) -> PlainDate
pub fn from_with_plain_date(item: &PlainDate) -> PlainDate
The Temporal.PlainDate.from() static method.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_plain_date_and_options(
item: &PlainDate,
options: &OverflowOptions,
) -> PlainDate
pub fn from_with_plain_date_and_options( item: &PlainDate, options: &OverflowOptions, ) -> PlainDate
The Temporal.PlainDate.from() static method.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_plain_date_time(item: &PlainDateTime) -> PlainDate
pub fn from_with_plain_date_time(item: &PlainDateTime) -> PlainDate
The Temporal.PlainDate.from() static method.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_plain_date_time_and_options(
item: &PlainDateTime,
options: &OverflowOptions,
) -> PlainDate
pub fn from_with_plain_date_time_and_options( item: &PlainDateTime, options: &OverflowOptions, ) -> PlainDate
The Temporal.PlainDate.from() static method.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_zoned_date_time(item: &ZonedDateTime) -> PlainDate
pub fn from_with_zoned_date_time(item: &ZonedDateTime) -> PlainDate
The Temporal.PlainDate.from() static method.
Source§impl PlainDate
impl PlainDate
Sourcepub fn from_with_zoned_date_time_and_options(
item: &ZonedDateTime,
options: &OverflowOptions,
) -> PlainDate
pub fn from_with_zoned_date_time_and_options( item: &ZonedDateTime, options: &OverflowOptions, ) -> PlainDate
The Temporal.PlainDate.from() static method.
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Sourcepub fn month_code(&self) -> JsString
pub fn month_code(&self) -> JsString
The monthCode accessor property returns a calendar-specific string representing
the month of this date.
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Sourcepub fn calendar_id(&self) -> JsString
pub fn calendar_id(&self) -> JsString
The calendarId accessor property returns a string representing the calendar
used to interpret the internal ISO 8601 date.
Source§impl PlainDate
impl PlainDate
Sourcepub fn day_of_week(&self) -> u32
pub fn day_of_week(&self) -> u32
The dayOfWeek accessor property returns a positive integer representing the
day of the week of this date (1 = Monday through 7 = Sunday for ISO 8601).
Source§impl PlainDate
impl PlainDate
Sourcepub fn day_of_year(&self) -> u32
pub fn day_of_year(&self) -> u32
The dayOfYear accessor property returns a positive integer representing the
1-based day index of this date in the year.
Source§impl PlainDate
impl PlainDate
Sourcepub fn week_of_year(&self) -> Option<u32>
pub fn week_of_year(&self) -> Option<u32>
The weekOfYear accessor property returns a positive integer representing the
1-based week index in the yearOfWeek of this date, or None if the
calendar does not have a well-defined week system.
Source§impl PlainDate
impl PlainDate
Sourcepub fn year_of_week(&self) -> Option<i32>
pub fn year_of_week(&self) -> Option<i32>
The yearOfWeek accessor property returns an integer representing the year
to be paired with weekOfYear, or None if the calendar does not have
a well-defined week system.
Source§impl PlainDate
impl PlainDate
Sourcepub fn days_in_week(&self) -> u32
pub fn days_in_week(&self) -> u32
The daysInWeek accessor property returns a positive integer representing the
number of days in the week of this date.
Source§impl PlainDate
impl PlainDate
Sourcepub fn days_in_month(&self) -> u32
pub fn days_in_month(&self) -> u32
The daysInMonth accessor property returns a positive integer representing the
number of days in the month of this date.
Source§impl PlainDate
impl PlainDate
Sourcepub fn days_in_year(&self) -> u32
pub fn days_in_year(&self) -> u32
The daysInYear accessor property returns a positive integer representing the
number of days in the year of this date.
Source§impl PlainDate
impl PlainDate
Sourcepub fn months_in_year(&self) -> u32
pub fn months_in_year(&self) -> u32
The monthsInYear accessor property returns a positive integer representing the
number of months in the year of this date.
Source§impl PlainDate
impl PlainDate
Sourcepub fn in_leap_year(&self) -> bool
pub fn in_leap_year(&self) -> bool
The inLeapYear accessor property returns true if this date is in a leap year,
and false otherwise.
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Sourcepub fn with(&self, fields: &PlainDateFields) -> Result<PlainDate, Error>
pub fn with(&self, fields: &PlainDateFields) -> Result<PlainDate, Error>
The with() method returns a new Temporal.PlainDate object with some
fields replaced by new values.
§Errors
Throws a TypeError if no recognised field is set, and a RangeError if values are out
of range or overflow is 'reject' and a field would need constraining.
Source§impl PlainDate
impl PlainDate
Sourcepub fn equals_with_plain_date_time(&self, other: &PlainDateTime) -> bool
pub fn equals_with_plain_date_time(&self, other: &PlainDateTime) -> bool
The equals() method taking a Temporal.PlainDateTime.
Source§impl PlainDate
impl PlainDate
Sourcepub fn equals_with_zoned_date_time(&self, other: &ZonedDateTime) -> bool
pub fn equals_with_zoned_date_time(&self, other: &ZonedDateTime) -> bool
The equals() method taking a Temporal.ZonedDateTime.
Source§impl PlainDate
impl PlainDate
Sourcepub fn equals_with_plain_date_like(
&self,
other: &PlainDateLike,
) -> Result<bool, Error>
pub fn equals_with_plain_date_like( &self, other: &PlainDateLike, ) -> Result<bool, Error>
The equals() method taking a property bag; throws a TypeError if required fields are missing.
Source§impl PlainDate
impl PlainDate
Sourcepub fn equals_with_str(&self, other: &str) -> Result<bool, RangeError>
pub fn equals_with_str(&self, other: &str) -> Result<bool, RangeError>
The equals() method taking an ISO 8601 string; throws a RangeError if the string is invalid.
Source§impl PlainDate
impl PlainDate
Sourcepub fn with_with_options(
&self,
fields: &PlainDateFields,
options: &OverflowOptions,
) -> Result<PlainDate, Error>
pub fn with_with_options( &self, fields: &PlainDateFields, options: &OverflowOptions, ) -> Result<PlainDate, Error>
The with() method returns a new Temporal.PlainDate object with some
fields replaced by new values.
§Errors
Throws a TypeError if no recognised field is set, and a RangeError if values are out
of range or overflow is 'reject' and a field would need constraining.
Source§impl PlainDate
impl PlainDate
Sourcepub fn with_calendar(&self, calendar: &str) -> Result<PlainDate, RangeError>
pub fn with_calendar(&self, calendar: &str) -> Result<PlainDate, RangeError>
The withCalendar() method returns a new Temporal.PlainDate object with
the calendar replaced.
§Errors
Throws a RangeError if the calendar identifier is invalid.
Source§impl PlainDate
impl PlainDate
Sourcepub fn with_calendar_with_plain_date(&self, calendar: &PlainDate) -> PlainDate
pub fn with_calendar_with_plain_date(&self, calendar: &PlainDate) -> PlainDate
The withCalendar() method taking the calendar of the given Temporal.PlainDate.
Source§impl PlainDate
impl PlainDate
Sourcepub fn with_calendar_with_plain_date_time(
&self,
calendar: &PlainDateTime,
) -> PlainDate
pub fn with_calendar_with_plain_date_time( &self, calendar: &PlainDateTime, ) -> PlainDate
The withCalendar() method taking the calendar of the given Temporal.PlainDateTime.
Source§impl PlainDate
impl PlainDate
Sourcepub fn with_calendar_with_plain_year_month(
&self,
calendar: &PlainYearMonth,
) -> PlainDate
pub fn with_calendar_with_plain_year_month( &self, calendar: &PlainYearMonth, ) -> PlainDate
The withCalendar() method taking the calendar of the given Temporal.PlainYearMonth.
Source§impl PlainDate
impl PlainDate
Sourcepub fn with_calendar_with_plain_month_day(
&self,
calendar: &PlainMonthDay,
) -> PlainDate
pub fn with_calendar_with_plain_month_day( &self, calendar: &PlainMonthDay, ) -> PlainDate
The withCalendar() method taking the calendar of the given Temporal.PlainMonthDay.
Source§impl PlainDate
impl PlainDate
Sourcepub fn with_calendar_with_zoned_date_time(
&self,
calendar: &ZonedDateTime,
) -> PlainDate
pub fn with_calendar_with_zoned_date_time( &self, calendar: &ZonedDateTime, ) -> PlainDate
The withCalendar() method taking the calendar of the given Temporal.ZonedDateTime.
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Sourcepub fn add_with_options(
&self,
duration: &Duration,
options: &OverflowOptions,
) -> Result<PlainDate, RangeError>
pub fn add_with_options( &self, duration: &Duration, options: &OverflowOptions, ) -> Result<PlainDate, RangeError>
The add() method returns a new Temporal.PlainDate object with the
duration added to this date.
§Errors
Throws a RangeError if the result is out of range, or if overflow is 'reject' and a
field would need constraining.
Source§impl PlainDate
impl PlainDate
Sourcepub fn add_with_duration_like(
&self,
duration: &DurationLike,
) -> Result<PlainDate, Error>
pub fn add_with_duration_like( &self, duration: &DurationLike, ) -> Result<PlainDate, Error>
The add() method taking a duration property bag.
§Errors
Throws a TypeError if no duration field is set; see PlainDate::add for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn add_with_duration_like_and_options(
&self,
duration: &DurationLike,
options: &OverflowOptions,
) -> Result<PlainDate, Error>
pub fn add_with_duration_like_and_options( &self, duration: &DurationLike, options: &OverflowOptions, ) -> Result<PlainDate, Error>
The add() method taking a duration property bag and options; see
PlainDate::add_with_duration_like for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn add_with_str_and_options(
&self,
duration: &str,
options: &OverflowOptions,
) -> Result<PlainDate, RangeError>
pub fn add_with_str_and_options( &self, duration: &str, options: &OverflowOptions, ) -> Result<PlainDate, RangeError>
The add() method taking an ISO 8601 duration string and options; see
PlainDate::add_with_str for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn add_with_str(&self, duration: &str) -> Result<PlainDate, RangeError>
pub fn add_with_str(&self, duration: &str) -> Result<PlainDate, RangeError>
The add() method taking an ISO 8601 duration string.
§Errors
Throws a RangeError if the string is not a valid duration; see PlainDate::add for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn subtract(&self, duration: &Duration) -> Result<PlainDate, RangeError>
pub fn subtract(&self, duration: &Duration) -> Result<PlainDate, RangeError>
The subtract() method returns a new Temporal.PlainDate object with the
duration subtracted from this date.
§Errors
Throws a RangeError if the result is out of range, or if overflow is 'reject' and a
field would need constraining.
Source§impl PlainDate
impl PlainDate
Sourcepub fn subtract_with_options(
&self,
duration: &Duration,
options: &OverflowOptions,
) -> Result<PlainDate, RangeError>
pub fn subtract_with_options( &self, duration: &Duration, options: &OverflowOptions, ) -> Result<PlainDate, RangeError>
The subtract() method returns a new Temporal.PlainDate object with the
duration subtracted from this date.
§Errors
Throws a RangeError if the result is out of range, or if overflow is 'reject' and a
field would need constraining.
Source§impl PlainDate
impl PlainDate
Sourcepub fn subtract_with_duration_like(
&self,
duration: &DurationLike,
) -> Result<PlainDate, Error>
pub fn subtract_with_duration_like( &self, duration: &DurationLike, ) -> Result<PlainDate, Error>
The subtract() method taking a duration property bag.
§Errors
Throws a TypeError if no duration field is set; see PlainDate::subtract for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn subtract_with_duration_like_and_options(
&self,
duration: &DurationLike,
options: &OverflowOptions,
) -> Result<PlainDate, Error>
pub fn subtract_with_duration_like_and_options( &self, duration: &DurationLike, options: &OverflowOptions, ) -> Result<PlainDate, Error>
The subtract() method taking a duration property bag and options; see
PlainDate::subtract_with_duration_like for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn subtract_with_str_and_options(
&self,
duration: &str,
options: &OverflowOptions,
) -> Result<PlainDate, RangeError>
pub fn subtract_with_str_and_options( &self, duration: &str, options: &OverflowOptions, ) -> Result<PlainDate, RangeError>
The subtract() method taking an ISO 8601 duration string and options; see
PlainDate::subtract_with_str for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn subtract_with_str(&self, duration: &str) -> Result<PlainDate, RangeError>
pub fn subtract_with_str(&self, duration: &str) -> Result<PlainDate, RangeError>
The subtract() method taking an ISO 8601 duration string.
§Errors
Throws a RangeError if the string is not a valid duration; see PlainDate::subtract for the remaining errors.
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_options(
&self,
other: &PlainDate,
options: &DifferenceOptions,
) -> Result<Duration, RangeError>
pub fn until_with_options( &self, other: &PlainDate, options: &DifferenceOptions, ) -> Result<Duration, RangeError>
The until() method returns a Temporal.Duration representing the duration
from this date until other.
§Errors
Throws a RangeError if dates have different calendars or options are invalid.
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_plain_date_time(
&self,
other: &PlainDateTime,
) -> Result<Duration, RangeError>
pub fn until_with_plain_date_time( &self, other: &PlainDateTime, ) -> Result<Duration, RangeError>
The until() method taking a Temporal.PlainDateTime; see PlainDate::until for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_plain_date_time_and_options(
&self,
other: &PlainDateTime,
options: &DifferenceOptions,
) -> Result<Duration, RangeError>
pub fn until_with_plain_date_time_and_options( &self, other: &PlainDateTime, options: &DifferenceOptions, ) -> Result<Duration, RangeError>
The until() method taking a Temporal.PlainDateTime and options; see PlainDate::until_with_options
for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_zoned_date_time(
&self,
other: &ZonedDateTime,
) -> Result<Duration, RangeError>
pub fn until_with_zoned_date_time( &self, other: &ZonedDateTime, ) -> Result<Duration, RangeError>
The until() method taking a Temporal.ZonedDateTime; see PlainDate::until for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_zoned_date_time_and_options(
&self,
other: &ZonedDateTime,
options: &DifferenceOptions,
) -> Result<Duration, RangeError>
pub fn until_with_zoned_date_time_and_options( &self, other: &ZonedDateTime, options: &DifferenceOptions, ) -> Result<Duration, RangeError>
The until() method taking a Temporal.ZonedDateTime and options; see PlainDate::until_with_options
for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_plain_date_like(
&self,
other: &PlainDateLike,
) -> Result<Duration, Error>
pub fn until_with_plain_date_like( &self, other: &PlainDateLike, ) -> Result<Duration, Error>
The until() method taking a property bag; throws a TypeError if required fields are missing; see PlainDate::until for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_plain_date_like_and_options(
&self,
other: &PlainDateLike,
options: &DifferenceOptions,
) -> Result<Duration, Error>
pub fn until_with_plain_date_like_and_options( &self, other: &PlainDateLike, options: &DifferenceOptions, ) -> Result<Duration, Error>
The until() method taking a property bag and options; throws a TypeError if required
fields are missing. See PlainDate::until_with_options for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_str(&self, other: &str) -> Result<Duration, RangeError>
pub fn until_with_str(&self, other: &str) -> Result<Duration, RangeError>
The until() method taking an ISO 8601 string; throws a RangeError if the string is invalid; see PlainDate::until for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn until_with_str_and_options(
&self,
other: &str,
options: &DifferenceOptions,
) -> Result<Duration, RangeError>
pub fn until_with_str_and_options( &self, other: &str, options: &DifferenceOptions, ) -> Result<Duration, RangeError>
The until() method taking an ISO 8601 string and options; see PlainDate::until_with_options
for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_options(
&self,
other: &PlainDate,
options: &DifferenceOptions,
) -> Result<Duration, RangeError>
pub fn since_with_options( &self, other: &PlainDate, options: &DifferenceOptions, ) -> Result<Duration, RangeError>
The since() method returns a Temporal.Duration representing the duration
from other until this date.
§Errors
Throws a RangeError if dates have different calendars or options are invalid.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_plain_date_time(&self) -> Result<PlainDateTime, RangeError>
pub fn to_plain_date_time(&self) -> Result<PlainDateTime, RangeError>
The toPlainDateTime() method returns a Temporal.PlainDateTime object representing
this date at the given time (or midnight if not provided).
§Errors
Throws a RangeError if the result falls outside the representable range.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_plain_date_time(
&self,
other: &PlainDateTime,
) -> Result<Duration, RangeError>
pub fn since_with_plain_date_time( &self, other: &PlainDateTime, ) -> Result<Duration, RangeError>
The since() method taking a Temporal.PlainDateTime; see PlainDate::since for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_plain_date_time_and_options(
&self,
other: &PlainDateTime,
options: &DifferenceOptions,
) -> Result<Duration, RangeError>
pub fn since_with_plain_date_time_and_options( &self, other: &PlainDateTime, options: &DifferenceOptions, ) -> Result<Duration, RangeError>
The since() method taking a Temporal.PlainDateTime and options; see PlainDate::since_with_options
for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_zoned_date_time(
&self,
other: &ZonedDateTime,
) -> Result<Duration, RangeError>
pub fn since_with_zoned_date_time( &self, other: &ZonedDateTime, ) -> Result<Duration, RangeError>
The since() method taking a Temporal.ZonedDateTime; see PlainDate::since for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_zoned_date_time_and_options(
&self,
other: &ZonedDateTime,
options: &DifferenceOptions,
) -> Result<Duration, RangeError>
pub fn since_with_zoned_date_time_and_options( &self, other: &ZonedDateTime, options: &DifferenceOptions, ) -> Result<Duration, RangeError>
The since() method taking a Temporal.ZonedDateTime and options; see PlainDate::since_with_options
for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_plain_date_like(
&self,
other: &PlainDateLike,
) -> Result<Duration, Error>
pub fn since_with_plain_date_like( &self, other: &PlainDateLike, ) -> Result<Duration, Error>
The since() method taking a property bag; throws a TypeError if required fields are missing; see PlainDate::since for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_plain_date_like_and_options(
&self,
other: &PlainDateLike,
options: &DifferenceOptions,
) -> Result<Duration, Error>
pub fn since_with_plain_date_like_and_options( &self, other: &PlainDateLike, options: &DifferenceOptions, ) -> Result<Duration, Error>
The since() method taking a property bag and options; throws a TypeError if required
fields are missing. See PlainDate::since_with_options for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_str(&self, other: &str) -> Result<Duration, RangeError>
pub fn since_with_str(&self, other: &str) -> Result<Duration, RangeError>
The since() method taking an ISO 8601 string; throws a RangeError if the string is invalid; see PlainDate::since for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn since_with_str_and_options(
&self,
other: &str,
options: &DifferenceOptions,
) -> Result<Duration, RangeError>
pub fn since_with_str_and_options( &self, other: &str, options: &DifferenceOptions, ) -> Result<Duration, RangeError>
The since() method taking an ISO 8601 string and options; see PlainDate::since_with_options
for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_plain_date_time_with_plain_time(
&self,
plain_time: &PlainTime,
) -> Result<PlainDateTime, RangeError>
pub fn to_plain_date_time_with_plain_time( &self, plain_time: &PlainTime, ) -> Result<PlainDateTime, RangeError>
The toPlainDateTime() method returns a Temporal.PlainDateTime object representing
this date at the given time (or midnight if not provided).
§Errors
Throws a RangeError if the result falls outside the representable range.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_zoned_date_time(
&self,
time_zone: &str,
) -> Result<ZonedDateTime, RangeError>
pub fn to_zoned_date_time( &self, time_zone: &str, ) -> Result<ZonedDateTime, RangeError>
The toZonedDateTime() method returns a Temporal.ZonedDateTime object representing
this date at the given time in the given time zone.
§Errors
Throws a RangeError if the time zone identifier is invalid.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_plain_date_time_with_str(
&self,
plain_time: &str,
) -> Result<PlainDateTime, RangeError>
pub fn to_plain_date_time_with_str( &self, plain_time: &str, ) -> Result<PlainDateTime, RangeError>
The toPlainDateTime() method taking an ISO 8601 string; throws a RangeError if the string is invalid; see PlainDate::to_plain_date_time for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_plain_date_time_with_plain_time_like(
&self,
plain_time: &PlainTimeLike,
) -> Result<PlainDateTime, Error>
pub fn to_plain_date_time_with_plain_time_like( &self, plain_time: &PlainTimeLike, ) -> Result<PlainDateTime, Error>
The toPlainDateTime() method taking a property bag; throws a TypeError if no time field is present; see PlainDate::to_plain_date_time for the remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_plain_date_time_with_plain_date_time(
&self,
plain_time: &PlainDateTime,
) -> Result<PlainDateTime, RangeError>
pub fn to_plain_date_time_with_plain_date_time( &self, plain_time: &PlainDateTime, ) -> Result<PlainDateTime, RangeError>
The toPlainDateTime() method taking a Temporal.PlainDateTime; see PlainDate::to_plain_date_time for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_plain_date_time_with_zoned_date_time(
&self,
plain_time: &ZonedDateTime,
) -> Result<PlainDateTime, RangeError>
pub fn to_plain_date_time_with_zoned_date_time( &self, plain_time: &ZonedDateTime, ) -> Result<PlainDateTime, RangeError>
The toPlainDateTime() method taking a Temporal.ZonedDateTime; see PlainDate::to_plain_date_time for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_zoned_date_time_with_zoned_date_time(
&self,
time_zone: &ZonedDateTime,
) -> Result<ZonedDateTime, RangeError>
pub fn to_zoned_date_time_with_zoned_date_time( &self, time_zone: &ZonedDateTime, ) -> Result<ZonedDateTime, RangeError>
The toZonedDateTime() method in the time zone of the given
Temporal.ZonedDateTime; see PlainDate::to_zoned_date_time for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_zoned_date_time_with_to_zoned_date_time_item(
&self,
item: &ToZonedDateTimeItem,
) -> Result<ZonedDateTime, Error>
pub fn to_zoned_date_time_with_to_zoned_date_time_item( &self, item: &ToZonedDateTimeItem, ) -> Result<ZonedDateTime, Error>
The toZonedDateTime() method returns a Temporal.ZonedDateTime object representing
this date at the given time in the given time zone.
§Errors
Throws a RangeError if the time zone identifier is invalid.
Throws a TypeError if plainTime is a property bag with no time fields.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_plain_year_month(&self) -> Result<PlainYearMonth, RangeError>
pub fn to_plain_year_month(&self) -> Result<PlainYearMonth, RangeError>
The toPlainYearMonth() method returns a Temporal.PlainYearMonth object representing
the year and month of this date.
§Errors
Throws a RangeError if the first day of this date’s calendar month falls
before the representable range, which can happen for non-ISO calendars at
the lower limit.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_plain_month_day(&self) -> PlainMonthDay
pub fn to_plain_month_day(&self) -> PlainMonthDay
The toPlainMonthDay() method returns a Temporal.PlainMonthDay object representing
the month and day of this date.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_locale_string(&self) -> Result<JsString, RangeError>
pub fn to_locale_string(&self) -> Result<JsString, RangeError>
The toLocaleString() method returns a language-sensitive string representation
of this date.
§Errors
Throws a RangeError if locales is invalid or the locale’s calendar does
not match this value’s calendar.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_locale_string_with_str(
&self,
locales: &str,
) -> Result<JsString, RangeError>
pub fn to_locale_string_with_str( &self, locales: &str, ) -> Result<JsString, RangeError>
The toLocaleString() method; see PlainDate::to_locale_string for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_locale_string_with_str_sequence(
&self,
locales: &[JsString],
) -> Result<JsString, RangeError>
pub fn to_locale_string_with_str_sequence( &self, locales: &[JsString], ) -> Result<JsString, RangeError>
The toLocaleString() method; see PlainDate::to_locale_string for errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_locale_string_with_str_sequence_and_options(
&self,
locales: &[JsString],
options: &DateTimeFormatOptions,
) -> Result<JsString, Error>
pub fn to_locale_string_with_str_sequence_and_options( &self, locales: &[JsString], options: &DateTimeFormatOptions, ) -> Result<JsString, Error>
The toLocaleString() method with options; throws a TypeError if an option does not
apply to this type or conflicts with another. See PlainDate::to_locale_string for the
remaining errors.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_locale_string_with_options(
&self,
locales: Option<&str>,
options: &DateTimeFormatOptions,
) -> Result<JsString, Error>
pub fn to_locale_string_with_options( &self, locales: Option<&str>, options: &DateTimeFormatOptions, ) -> Result<JsString, Error>
The toLocaleString() method with options; None for locales uses the default locale.
Throws a TypeError if an option does not apply to this type or conflicts with another.
See PlainDate::to_locale_string for the remaining errors.
Source§impl PlainDate
impl PlainDate
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_js_string(&self) -> JsString
pub fn to_js_string(&self) -> JsString
The toString() method returns an RFC 9557 string representation of this date.
Source§impl PlainDate
impl PlainDate
Sourcepub fn to_js_string_with_options(
&self,
options: &ShowCalendarOptions,
) -> Result<JsString, RangeError>
pub fn to_js_string_with_options( &self, options: &ShowCalendarOptions, ) -> Result<JsString, RangeError>
The toString() method returns an RFC 9557 string representation of this date,
formatted according to options.
§Errors
Throws a RangeError if the options are invalid for this type.
Methods from Deref<Target = Object>§
Sourcepub fn constructor(&self) -> Function
pub fn constructor(&self) -> Function
The constructor property returns a reference to the Object constructor
function that created the instance object.
Sourcepub fn has_own_property(&self, property: &JsValue) -> bool
👎Deprecated: Use Object::hasOwn instead.
pub fn has_own_property(&self, property: &JsValue) -> bool
Use Object::hasOwn instead.
The hasOwnProperty() method returns a boolean indicating whether the
object has the specified property as its own property (as opposed to
inheriting it).
Sourcepub fn is_prototype_of(&self, value: &JsValue) -> bool
pub fn is_prototype_of(&self, value: &JsValue) -> bool
The isPrototypeOf() method checks if an object exists in another
object’s prototype chain.
Sourcepub fn property_is_enumerable(&self, property: &JsValue) -> bool
pub fn property_is_enumerable(&self, property: &JsValue) -> bool
The propertyIsEnumerable() method returns a Boolean indicating
whether the specified property is enumerable.
Sourcepub fn to_locale_string(&self) -> JsString
pub fn to_locale_string(&self) -> JsString
The toLocaleString() method returns a string representing the object.
This method is meant to be overridden by derived objects for
locale-specific purposes.
Sourcepub fn to_string(&self) -> JsString
pub fn to_string(&self) -> JsString
The toString() method returns a string representing the object.
Sourcepub fn to_js_string(&self) -> JsString
pub fn to_js_string(&self) -> JsString
The toString() method returns a string representing the object.
Methods from Deref<Target = JsValue>§
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns the f64 value of this JS value if it’s an instance of a
number.
If this JS value is not an instance of a number then this returns
None.
Sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
If this JS value is a string value, this function copies the JS string
value into Wasm linear memory, encoded as UTF-8, and returns it as a
Rust String.
To avoid the copying and re-encoding, consider the
JsString::try_from() function from js-sys
instead.
If this JS value is not an instance of a string or if it’s not valid
utf-8 then this returns None.
§UTF-16 vs UTF-8
JavaScript strings in general are encoded as UTF-16, but Rust strings
are encoded as UTF-8. This can cause the Rust string to look a bit
different than the JS string sometimes. For more details see the
documentation about the str type which contains a few
caveats about the encodings.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the bool value of this JS value if it’s an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None.
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Tests whether this JS value is undefined
Sourcepub fn is_null_or_undefined(&self) -> bool
pub fn is_null_or_undefined(&self) -> bool
Tests whether this JS value is null or undefined
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Tests whether the type of this JS value is function.
Sourcepub fn js_in(&self, obj: &JsValue) -> bool
pub fn js_in(&self, obj: &JsValue) -> bool
Applies the binary in JS operator on the two JsValues.
Sourcepub fn loose_eq(&self, other: &JsValue) -> bool
pub fn loose_eq(&self, other: &JsValue) -> bool
Compare two JsValues for equality, using the == operator in JS.
Sourcepub fn unsigned_shr(&self, rhs: &JsValue) -> u32
pub fn unsigned_shr(&self, rhs: &JsValue) -> u32
Applies the binary >>> JS operator on the two JsValues.
Sourcepub fn checked_div(&self, rhs: &JsValue) -> JsValue
pub fn checked_div(&self, rhs: &JsValue) -> JsValue
Applies the binary / JS operator on two JsValues, catching and returning any RangeError thrown.
Sourcepub fn pow(&self, rhs: &JsValue) -> JsValue
pub fn pow(&self, rhs: &JsValue) -> JsValue
Applies the binary ** JS operator on the two JsValues.
Sourcepub fn lt(&self, other: &JsValue) -> bool
pub fn lt(&self, other: &JsValue) -> bool
Applies the binary < JS operator on the two JsValues.
Sourcepub fn le(&self, other: &JsValue) -> bool
pub fn le(&self, other: &JsValue) -> bool
Applies the binary <= JS operator on the two JsValues.
Sourcepub fn ge(&self, other: &JsValue) -> bool
pub fn ge(&self, other: &JsValue) -> bool
Applies the binary >= JS operator on the two JsValues.
Sourcepub fn gt(&self, other: &JsValue) -> bool
pub fn gt(&self, other: &JsValue) -> bool
Applies the binary > JS operator on the two JsValues.
Sourcepub fn unchecked_into_f64(&self) -> f64
pub fn unchecked_into_f64(&self) -> f64
Applies the unary + JS operator on a JsValue. Can throw.
Trait Implementations§
impl Eq for PlainDate
Source§impl ErasableGeneric for PlainDate
impl ErasableGeneric for PlainDate
Source§impl FromWasmAbi for PlainDate
impl FromWasmAbi for PlainDate
Source§impl IntoJsGeneric for PlainDate
impl IntoJsGeneric for PlainDate
Source§impl IntoWasmAbi for PlainDate
impl IntoWasmAbi for PlainDate
Source§impl<'__wbg_ref> IntoWasmAbi for &'__wbg_ref PlainDate
impl<'__wbg_ref> IntoWasmAbi for &'__wbg_ref PlainDate
Source§impl JsCast for PlainDate
impl JsCast for PlainDate
Source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
instanceof check to see whether the JsValue
provided is an instance of this type. Read moreSource§fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js(val: JsValue) -> Self
Source§fn unchecked_from_js_ref(val: &JsValue) -> &Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
Source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere
T: JsCast,
T. Read moreSource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
T. Read moreSource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
T. Read moreSource§fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_into<T>(self) -> Twhere
T: JsCast,
Source§fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
Source§impl LongRefFromWasmAbi for PlainDate
impl LongRefFromWasmAbi for PlainDate
Source§impl NullableFromWasmAbi for PlainDate
impl NullableFromWasmAbi for PlainDate
Source§impl NullableIntoWasmAbi for PlainDate
impl NullableIntoWasmAbi for PlainDate
Source§impl<'__wbg_ref> NullableIntoWasmAbi for &'__wbg_ref PlainDate
impl<'__wbg_ref> NullableIntoWasmAbi for &'__wbg_ref PlainDate
Source§impl OptionFromWasmAbi for PlainDate
impl OptionFromWasmAbi for PlainDate
Source§impl OptionIntoWasmAbi for PlainDate
impl OptionIntoWasmAbi for PlainDate
Source§impl<'__wbg_ref> OptionIntoWasmAbi for &'__wbg_ref PlainDate
impl<'__wbg_ref> OptionIntoWasmAbi for &'__wbg_ref PlainDate
Source§impl Promising for PlainDate
impl Promising for PlainDate
Source§type Resolution = PlainDate
type Resolution = PlainDate
Source§impl RefFromWasmAbi for PlainDate
impl RefFromWasmAbi for PlainDate
Source§type Abi = <JsValue as RefFromWasmAbi>::Abi
type Abi = <JsValue as RefFromWasmAbi>::Abi
Self are recovered from.Source§type Anchor = ManuallyDrop<PlainDate>
type Anchor = ManuallyDrop<PlainDate>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.impl UpcastFrom<PlainDate> for JsValue
impl UpcastFrom<PlainDate> for JsOption<JsValue>
impl UpcastFrom<PlainDate> for JsNullable<JsValue>
impl<__UpcastWrapTarget> UpcastFrom<PlainDate> for Option<__UpcastWrapTarget>where
__UpcastWrapTarget: UpcastFrom<PlainDate>,
impl<__UpcastWrapTarget> UpcastFrom<PlainDate> for Nullable<__UpcastWrapTarget>where
__UpcastWrapTarget: UpcastFrom<PlainDate>,
impl UpcastFrom<PlainDate> for PlainDate
impl UpcastFrom<PlainDate> for JsOption<PlainDate>
impl UpcastFrom<PlainDate> for JsNullable<PlainDate>
impl UpcastFrom<PlainDate> for Object
impl UpcastFrom<PlainDate> for JsOption<Object>
impl UpcastFrom<PlainDate> for JsNullable<Object>
Source§impl VectorRefIntoWasmAbi for PlainDate
impl VectorRefIntoWasmAbi for PlainDate
fn slice_into_abi(slice: &[Self]) -> WasmSlice
impl VectorRefIntoWasmAbiSealed for PlainDate
Auto Trait Implementations§
impl Forget for PlainDate
impl Freeze for PlainDate
impl Move for PlainDate
impl RefUnwindSafe for PlainDate
impl Send for PlainDate
impl Sync for PlainDate
impl Unpin for PlainDate
impl UnsafeUnpin for PlainDate
impl UnwindSafe for PlainDate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> JsGeneric for T
Source§impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
Source§type MaybeAbi = <T as FromWasmAbi>::Abi
type MaybeAbi = <T as FromWasmAbi>::Abi
Option<Self>.Source§unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn try_from_maybe_abi( js: <T as FromWasmAbi>::Abi, ) -> Result<T, &'static str>
Source§impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
Source§type MaybeAbi = <T as IntoWasmAbi>::Abi
type MaybeAbi = <T as IntoWasmAbi>::Abi
Option<Self>.Source§fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
Option<Self> ABI.Source§impl<T, A> RefIntoWasmAbi for T
impl<T, A> RefIntoWasmAbi for T
Source§fn describe_ref()
fn describe_ref()
&Self.Source§fn ref_into_abi(&self) -> A
fn ref_into_abi(&self) -> A
&self into Self::Abi.Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.