From f639cccd8ba7cbd42a7f579e86d68d60b7fcb3a8 Mon Sep 17 00:00:00 2001 From: Charles Gauthereau Date: Sat, 17 Oct 2026 19:35:52 +0200 Subject: [PATCH 1/2] fix: use local time for the backup date folder The remote path date folder used UTC, so backups taken after local midnight in non-UTC zones landed in the previous day's folder. Use the container timezone (TZ), like the scheduler already does. Refs Portabase/portabase#330 --- src/utils/file.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/file.rs b/src/utils/file.rs index b39dd92..0eb8fc4 100644 --- a/src/utils/file.rs +++ b/src/utils/file.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] use anyhow::Result; -use chrono::Utc; +use chrono::Local; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use tokio::fs::File; @@ -54,7 +54,7 @@ pub fn full_file_path(file_name: &String, folder_name: Option<&str>) -> String { .filter(|folder_name| !folder_name.is_empty()) .unwrap_or("backups"); - format!("{}/{}/{}", folder_name, Utc::now().format("%Y-%m-%d"), file_name) + format!("{}/{}/{}", folder_name, Local::now().format("%Y-%m-%d"), file_name) } const CHUNK_SIZE: usize = 16 * 1024 * 1024; From 036995eac17983add2be2993ad84d43dcaa3a17e Mon Sep 17 00:00:00 2001 From: Charles Gauthereau Date: Sat, 17 Oct 2026 19:37:17 +0200 Subject: [PATCH 2/2] fix: refactoring --- src/utils/file.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/file.rs b/src/utils/file.rs index 0eb8fc4..10bac58 100644 --- a/src/utils/file.rs +++ b/src/utils/file.rs @@ -1,7 +1,6 @@ #![allow(dead_code)] use anyhow::Result; -use chrono::Local; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use tokio::fs::File; @@ -54,7 +53,7 @@ pub fn full_file_path(file_name: &String, folder_name: Option<&str>) -> String { .filter(|folder_name| !folder_name.is_empty()) .unwrap_or("backups"); - format!("{}/{}/{}", folder_name, Local::now().format("%Y-%m-%d"), file_name) + format!("{}/{}/{}", folder_name, chrono::Local::now().format("%Y-%m-%d"), file_name) } const CHUNK_SIZE: usize = 16 * 1024 * 1024;