Function use_calendar

Source
pub fn use_calendar() -> UseCalendarReturn<impl Fn() + Clone + Send + Sync, impl Fn() + Clone + Send + Sync, impl Fn() + Clone + Send + Sync>
Expand description

Create bare-bone calendar data to use in your component. See UseCalendarOptions for options and UseCalendarReturn for return values.

§Demo

Link to Demo

§Usage

let UseCalendarReturn {
    dates,
    weekdays,
    previous_month,
    today,
    next_month
} = use_calendar();

Use use_calendar_with_options to change the initial date and first day of the week.

let initial_date = RwSignal::new(
    Some(NaiveDate::from_ymd_opt(2022, 1, 1).unwrap())
);

let options = UseCalendarOptions::default()
    .first_day_of_the_week(6)
    .initial_date(initial_date);

let UseCalendarReturn {
    dates,
    weekdays,
    previous_month,
    today,
    next_month
} = use_calendar_with_options(options);

§Server-Side Rendering

Not tested yet.