fixed non-local time

This commit is contained in:
aaron-jack-manning 2022-09-23 08:45:57 +10:00
parent 3f7148c8ef
commit f5fb7e1a49
3 changed files with 3 additions and 3 deletions

2
Cargo.lock generated
View File

@ -775,7 +775,7 @@ dependencies = [
[[package]] [[package]]
name = "toru" name = "toru"
version = "0.5.0" version = "0.5.1"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",

View File

@ -42,7 +42,7 @@ pub fn time_per_tag(days : u16, vault_folder : &path::Path) -> Result<(), error:
let mut time = tasks::Duration::zero(); let mut time = tasks::Duration::zero();
for entry in &task.data.time_entries { for entry in &task.data.time_entries {
if chrono::Utc::now().naive_local().date() - entry.logged_date < chrono::Duration::days(i64::from(days)) { if chrono::Local::now().naive_local().date() - entry.logged_date < chrono::Duration::days(i64::from(days)) {
time = time + entry.duration; time = time + entry.duration;
} }
} }

View File

@ -215,7 +215,7 @@ impl TimeEntry {
pub fn new(duration : Duration, date : Option<chrono::NaiveDate>, message : Option<String>) -> Self { pub fn new(duration : Duration, date : Option<chrono::NaiveDate>, message : Option<String>) -> Self {
Self { Self {
logged_date : date.unwrap_or(chrono::Utc::now().naive_local().date()), logged_date : date.unwrap_or(chrono::Local::now().naive_local().date()),
message, message,
duration, duration,
} }