From dbf0808233241d632ef295c624461102e5e7f578 Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Sun, 19 Apr 2026 10:55:13 +0200 Subject: [PATCH] fix(daily): use midnight when creating file for non-today date --- src/cli/commands/daily.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cli/commands/daily.rs b/src/cli/commands/daily.rs index b202d0f..7edd317 100644 --- a/src/cli/commands/daily.rs +++ b/src/cli/commands/daily.rs @@ -65,7 +65,14 @@ pub fn run(date: Option) -> Result<(), StreamdError> { Command::new(&editor).arg(file_path).status()?; } else { let now_local = Utc::now().with_timezone(&tz); - let file_name = now_local.format("%Y%m%d-%H%M%S_daily.md").to_string(); + let file_timestamp = if target_date == now_local.date_naive() { + now_local + } else { + tz.from_local_datetime(&NaiveDateTime::new(target_date, NaiveTime::MIN)) + .earliest() + .unwrap() + }; + let file_name = file_timestamp.format("%Y%m%d-%H%M%S_daily.md").to_string(); let file_path = base_folder.join(&file_name); fs::write(&file_path, "# ")?; Command::new(&editor).arg(&file_path).status()?;