aboutsummaryrefslogtreecommitdiff
path: root/src/gui/app.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/app.rs')
-rw-r--r--src/gui/app.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/gui/app.rs b/src/gui/app.rs
index 5469e53..76dff71 100644
--- a/src/gui/app.rs
+++ b/src/gui/app.rs
@@ -2,7 +2,7 @@ use gtk4 as gtk;
use anyhow::Result;
use async_channel::Sender;
-use chrono::{Datelike, Duration, NaiveDate, Weekday};
+use chrono::{Datelike, Duration, NaiveDate};
use rusqlite::Connection;
use std::rc::Rc;
@@ -30,10 +30,7 @@ pub struct App {
impl App {
pub fn new(conn: Rc<Connection>, app: &gtk::Application, tx: Sender<Msg>) -> Result<Self> {
let today = chrono::offset::Local::now().naive_local().date();
- // TODO: error handling
- let start_date =
- NaiveDate::from_isoywd_opt(today.year(), today.iso_week().week(), Weekday::Mon)
- .unwrap();
+ let start_date = today - Duration::days(today.weekday().num_days_from_monday().into());
let end_date = start_date + Duration::days(7 * 4 - 1);
let events = db::events::list_non_recurring_between(&conn, start_date, end_date)?;