Trait script::dom::bindings::str::FromInputValueString

source ·
pub(crate) trait FromInputValueString {
    // Required methods
    fn parse_date_string(&self) -> Option<OffsetDateTime>;
    fn parse_month_string(&self) -> Option<OffsetDateTime>;
    fn parse_week_string(&self) -> Option<OffsetDateTime>;
    fn parse_time_string(&self) -> Option<OffsetDateTime>;
    fn parse_local_date_time_string(&self) -> Option<OffsetDateTime>;
    fn is_valid_time_string(&self) -> bool;
    fn is_valid_simple_color_string(&self) -> bool;
    fn is_valid_email_address_string(&self) -> bool;

    // Provided methods
    fn is_valid_date_string(&self) -> bool { ... }
    fn is_valid_month_string(&self) -> bool { ... }
    fn is_valid_week_string(&self) -> bool { ... }
    fn is_valid_local_date_time_string(&self) -> bool { ... }
}

Required Methods§

source

fn parse_date_string(&self) -> Option<OffsetDateTime>

https://html.spec.whatwg.org/multipage/#parse-a-date-string

Parse the date string and return an OffsetDateTime on midnight of the given date in UTC.

A valid date string should be “YYYY-MM-DD” YYYY must be four or more digits, MM and DD both must be two digits https://html.spec.whatwg.org/multipage/#valid-date-string

source

fn parse_month_string(&self) -> Option<OffsetDateTime>

https://html.spec.whatwg.org/multipage/#parse-a-month-string

Parse the month and return an OffsetDateTime on midnight of UTC of the morning of the first day of the parsed month.

A valid month string should be “YYYY-MM” YYYY must be four or more digits, MM both must be two digits https://html.spec.whatwg.org/multipage/#valid-month-string

source

fn parse_week_string(&self) -> Option<OffsetDateTime>

https://html.spec.whatwg.org/multipage/#parse-a-week-string

Parse the week string, returning an OffsetDateTime on the Monday of the parsed week.

A valid week string should be like {YYYY}-W{WW}, such as “2017-W52” YYYY must be four or more digits, WW both must be two digits https://html.spec.whatwg.org/multipage/#valid-week-string

source

fn parse_time_string(&self) -> Option<OffsetDateTime>

Parse this value as a time string according to https://html.spec.whatwg.org/multipage/#valid-time-string.

source

fn parse_local_date_time_string(&self) -> Option<OffsetDateTime>

https://html.spec.whatwg.org/multipage/#parse-a-local-date-and-time-string

Parse the local date and time, returning an OffsetDateTime in UTC or None.

source

fn is_valid_time_string(&self) -> bool

Validates whether or not this value is a valid time string according to https://html.spec.whatwg.org/multipage/#valid-time-string.

source

fn is_valid_simple_color_string(&self) -> bool

source

fn is_valid_email_address_string(&self) -> bool

Provided Methods§

source

fn is_valid_date_string(&self) -> bool

Validates whether or not this value is a valid date string according to https://html.spec.whatwg.org/multipage/#valid-date-string.

source

fn is_valid_month_string(&self) -> bool

Validates whether or not this value is a valid month string according to https://html.spec.whatwg.org/multipage/#valid-month-string.

source

fn is_valid_week_string(&self) -> bool

Validates whether or not this value is a valid week string according to https://html.spec.whatwg.org/multipage/#valid-week-string.

source

fn is_valid_local_date_time_string(&self) -> bool

Validates whether or not this value is a valid local date time string according to https://html.spec.whatwg.org/multipage/#valid-week-string.

Implementations on Foreign Types§

source§

impl FromInputValueString for &str

Implementors§