use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[derive(Debug, Clone, PartialEq)]
pub type DateSetEvent;
#[wasm_bindgen(method, js_name = preventDefault)]
pub fn prevent_default(this: &DateSetEvent);
}
impl DateSetEvent {
#[must_use]
pub fn start(&self) -> Option<web_sys::js_sys::Date> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("start"))
.ok()
.and_then(|v| {
v.dyn_into::<web_sys::js_sys::Date>()
.inspect_err(|e| web_sys::console::error_1(&format!("{e:#?}").into()))
.ok()
})
}
#[must_use]
pub fn end(&self) -> Option<web_sys::js_sys::Date> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("end"))
.ok()
.and_then(|v| {
v.dyn_into::<web_sys::js_sys::Date>()
.inspect_err(|e| web_sys::console::error_1(&format!("{e:#?}").into()))
.ok()
})
}
#[must_use]
pub fn start_str(&self) -> Option<String> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("startStr"))
.ok()
.and_then(|v| v.as_string())
}
#[must_use]
pub fn end_str(&self) -> Option<String> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("endStr"))
.ok()
.and_then(|v| v.as_string())
}
#[must_use]
pub fn time_zone(&self) -> Option<crate::options::TimeZone> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("timeZone"))
.ok()
.and_then(|v| v.as_string())
.and_then(|s| s.as_str().parse().ok())
}
#[must_use]
pub fn view(&self) -> Option<super::CalendarView> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("view"))
.ok()
.map(web_sys::wasm_bindgen::JsCast::unchecked_into::<super::CalendarView>)
}
}