Skip to content

Commit 6ac51f8

Browse files
committed
(time) use get_calendar_first from libcosmic
This removes the `time` module from `cosmic-applet-time`, as the only funnction there is also duplicated in `libcosmic`. Use that instead to avoid code duplication.
1 parent 3e4c969 commit 6ac51f8

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

cosmic-applet-time/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
pub use cosmic_applets_config::time as config;
55

66
mod localize;
7-
mod time;
87
mod window;
98

109
use window::Window;

cosmic-applet-time/src/time.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

cosmic-applet-time/src/window.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ use std::sync::LazyLock;
2828
use timedate_zbus::TimeDateProxy;
2929
use tokio::{sync::watch, time};
3030

31-
use crate::{config::TimeAppletConfig, fl, time::get_calendar_first};
31+
use crate::{config::TimeAppletConfig, fl};
3232
use cosmic::applet::token::subscription::{
3333
TokenRequest, TokenUpdate, activation_token_subscription,
3434
};
35+
use cosmic::widget::calendar::get_calender_first;
3536
use icu::{
3637
datetime::{
3738
DateTimeFormatter, DateTimeFormatterPreferences, fieldsets,
@@ -119,7 +120,11 @@ impl Window {
119120
let mut first_day_of_week = chrono::Weekday::try_from(self.config.first_day_of_week)
120121
.unwrap_or(chrono::Weekday::Sun);
121122

122-
let first_day = get_calendar_first(self.date_selected, first_day_of_week);
123+
let first_day = get_calender_first(
124+
self.date_selected.year(),
125+
self.date_selected.month(),
126+
first_day_of_week,
127+
);
123128

124129
let prefs = DateTimeFormatterPreferences::from(self.locale.clone());
125130
let weekday = DateTimeFormatter::try_new(prefs, fieldsets::E::short()).unwrap();

0 commit comments

Comments
 (0)