Fusuma

Components / Date and time

calendar

A calendar of month (1 to 12) of year with selected (a day of the month) marked.

Try it

This is the Pickers page of the gallery, running in your browser: calendar is on it, and it is the real widget. Press Run, then use it.

Live: Pickers, where calendar is usedOpen full size

Also on this pagetime_pickeraccordionsplit_viewselecttree_item

A calendar of month (1 to 12) of year with selected (a day of the month) marked. on_pick makes a message of the day that was pressed, on_month of -1 or +1 for the arrows (the app moves the month with shift_month).

.sunday_first() starts the weeks on Sunday. The grid is always six weeks tall, so the page does not jump between months.

Signature

pub const fn calendar<M>( year: i32, month: u8, selected: Option<u8>, on_pick: fn(u8) -> M, on_month: fn(i32) -> M, ) -> Calendar<M>

Methods

  • .sunday_first() -> Self — Weeks start on Sunday, as in the United States (Monday by default).

Example

use fusuma::{calendar, shift_month};
let (year, month) = shift_month(2024, 2, 0);
let view = calendar(year, month, Some(14), |day| i32::from(day), |step| 100 + step);
let built = fusuma::doc::built::<i32, _>(&view);
assert!(built.texts().contains(&"29"));

All components · Source