Menu
cosmic-mobile
publicLatest change bd10038fdf127d3b0f9f4ddc6c5afd463c4d2e34 - Calendar: iOS month grid, today/selection, event dots, day agenda, timed events via chrono by AkurAI Build
#[path = "../src/calendar.rs"]
mod calendar;
#[path = "../src/core_apps.rs"]
mod core_apps;
#[path = "../src/ios.rs"]
mod ios;
use chrono::{Datelike, NaiveDate};
#[test]
fn month_grid_starts_monday_and_covers_six_weeks() {
let sept = NaiveDate::from_ymd_opt(2026, 9, 6).unwrap();
let grid = calendar::Calendar::grid(sept);
assert_eq!(grid[0], NaiveDate::from_ymd_opt(2026, 8, 31).unwrap());
assert_eq!(grid[0].weekday().num_days_from_monday(), 0);
assert_eq!(grid[41], NaiveDate::from_ymd_opt(2026, 10, 11).unwrap());
assert_eq!(grid.iter().filter(|d| d.month() == 9).count(), 30);
}
#[test]
fn shift_clamps_day_and_today_resets() {
let mut c = calendar::Calendar::new(NaiveDate::from_ymd_opt(2026, 1, 31).unwrap());
c.shift(1);
assert_eq!(c.month, NaiveDate::from_ymd_opt(2026, 2, 1).unwrap());
c.shift(-2);
assert_eq!(c.month, NaiveDate::from_ymd_opt(2025, 12, 1).unwrap());
assert_eq!(c.selected.day(), 31);
}