From eb8d0e349fa588f21ecf0fbc430b2e82ff25640c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Vojinovi=C4=87?= <150025636+git-f0x@users.noreply.github.com> Date: Thu, 19 Feb 2026 19:32:13 +0100 Subject: [PATCH] fix(daytime): improve accuracy of `northern_tilt` --- cosmic-settings/src/subscription/daytime.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cosmic-settings/src/subscription/daytime.rs b/cosmic-settings/src/subscription/daytime.rs index 0376f5f..e4189c8 100644 --- a/cosmic-settings/src/subscription/daytime.rs +++ b/cosmic-settings/src/subscription/daytime.rs @@ -49,7 +49,9 @@ async fn inner(mut tx: Sender) -> anyhow::Result<()> { let coord = Coordinates::new(loc.latitude(), loc.longitude()).unwrap(); let now = jiff::Zoned::now(); let now_in_seconds = now.timestamp().as_second(); - let northern_tilt = now.month() >= 3 && now.month() <= 9; + // roughly matches the dates of the spring and autumn equinoxes + let northern_tilt = (79..=266).contains(&now.day_of_year()); + let is_north = coord.lat() > 0.0; // TODO: remove chrono if sunrise adds support for jiff - https://github.com/nathan-osman/rust-sunrise/pull/20 let date = NaiveDate::from_ymd_opt(now.year() as i32, now.month() as u32, now.day() as u32) .expect("jiff date is valid"); @@ -67,9 +69,7 @@ async fn inner(mut tx: Sender) -> anyhow::Result<()> { // transition out of polar day (None, Some(sunset)) => now_in_seconds <= sunset, // polar day - (None, None) => { - (coord.lat() > 0.0 && northern_tilt) || (coord.lat() < 0.0 && !northern_tilt) - } + (None, None) => is_north == northern_tilt, }; tx.send(daytime).await?;