From 8a42cf40ca505babe9a8c14aa35ad17244dad0fe Mon Sep 17 00:00:00 2001 From: Amy Date: Wed, 15 Jul 2026 00:07:57 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Use=20today=20as=20workday=20whe?= =?UTF-8?q?n=20end=5Fwork=20crosses=20midnight=20into=20a=20new=20day?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/gdarquie_work/commands/end_work.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/gdarquie_work/commands/end_work.rs b/src/plugins/gdarquie_work/commands/end_work.rs index 4242299..3a1485c 100644 --- a/src/plugins/gdarquie_work/commands/end_work.rs +++ b/src/plugins/gdarquie_work/commands/end_work.rs @@ -58,24 +58,29 @@ fn add_stop_work_annotations(last_annotation: &WorkAnnotationWithPath, path: &Pa chrono::Local::now().format("%:z") ); - // START_WORK for today + // START_WORK for today — use today as workday, not yesterday's annotate( Some(&today_datetime_string), EventName::StartWork, None, path.to_str().unwrap(), - last_annotation.annotation.workday.as_deref(), + Some(today.as_str()), ); } } - // we add a STOP_WORK annotation for today + // we add a STOP_WORK annotation for today — use today as workday when crossing midnight + let stop_workday = if last_annotation.annotation.workday.as_deref() == Some(&today) { + last_annotation.annotation.workday.as_deref() + } else { + Some(today.as_str()) + }; annotate( None, EventName::StopWork, None, path.to_str().unwrap(), - last_annotation.annotation.workday.as_deref(), + stop_workday, ); }