refactor(calendar): use jiff instead of chrono

This refactors the calendar widget to use `jiff` instead of `chrono`.
Also mostly matches the design of the widget to the time applet.
This commit is contained in:
Vukašin Vojinović 2026-02-17 20:32:21 +01:00 committed by Michael Murphy
parent b05f040e5f
commit 990e2e291b
5 changed files with 111 additions and 123 deletions

View file

@ -1,12 +1,12 @@
[package]
name = "calendar"
version = "0.1.0"
edition = "2021"
version = "1.0.0"
edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
chrono = "0.4.42"
jiff = "0.2"
[dependencies.libcosmic]
path = "../../"

View file

@ -3,10 +3,10 @@
//! Calendar widget example
use chrono::NaiveDate;
use cosmic::app::{Core, Settings, Task};
use cosmic::widget::calendar::CalendarModel;
use cosmic::{executor, iced, ApplicationExt, Element};
use cosmic::{ApplicationExt, Element, executor, iced};
use jiff::civil::{Date, Weekday};
/// Runs application with these settings
#[rustfmt::skip]
@ -19,7 +19,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
/// Messages that are used specifically by our [`App`].
#[derive(Clone, Debug)]
pub enum Message {
DateSelected(NaiveDate),
DateSelected(Date),
PrevMonth,
NextMonth,
}
@ -92,7 +92,7 @@ impl cosmic::Application for App {
|date| Message::DateSelected(date),
|| Message::PrevMonth,
|| Message::NextMonth,
chrono::Weekday::Sun,
Weekday::Sunday,
);
content = content.push(calendar);