From d6d9a876a3b9d5c9afbf083d7f158715364e08ab Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 21 Jan 2025 23:07:53 +0100 Subject: [PATCH] release: 0.9.0 - import, export, rust upgrade --- Cargo.lock | 2 +- Cargo.toml | 2 +- rust-toolchain.toml | 2 +- src/helpers.rs | 6 ++---- src/main.rs | 5 +++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d8b4fd..51fd4ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1543,7 +1543,7 @@ dependencies = [ [[package]] name = "mostr" -version = "0.8.0" +version = "0.9.0" dependencies = [ "base64 0.22.1", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 70c18a1..49b418b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ repository = "https://forge.ftt.gmbh/janek/mostr" readme = "README.md" license = "GPL 3.0" authors = ["melonion"] -version = "0.8.0" +version = "0.9.0" rust-version = "1.82" edition = "2021" default-run = "mostr" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 2e2b8c8..efd9dc3 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.82.0" +channel = "1.84.0" diff --git a/src/helpers.rs b/src/helpers.rs index 0ec49a6..8c4c915 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -134,10 +134,8 @@ pub fn format_as_datetime(stamp: &Timestamp, formatter: F) -> String where F: Fn(DateTime) -> String, { - match Local.timestamp_opt(stamp.as_u64() as i64 + 1, 0) { - Single(time) => formatter(time), - _ => stamp.to_human_datetime().to_string(), - } + Local.timestamp_opt(stamp.as_u64() as i64 + 1, 0).earliest() + .map_or_else(|| stamp.to_human_datetime().to_string(), formatter) } /// Format nostr Timestamp relative to local time diff --git a/src/main.rs b/src/main.rs index a6476d1..fe6ce0f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -683,7 +683,7 @@ async fn main() -> Result<()> { None => tasks.move_to(None), Some(arg) => { let pos = tasks.get_position_timestamped(); - let time = pos.1.and_then(|_| Local.timestamp_millis_opt(pos.0.as_u64() as i64 * 1000).earliest()); + let time = pos.1.and_then(|_| Local.timestamp_opt(pos.0.as_u64() as i64, 0).earliest()); if parse_tracking_stamp(arg, time) .and_then(|stamp| tasks.track_at(stamp, None)).is_some() { println!("{}", tasks.times_tracked(15)); @@ -714,7 +714,8 @@ async fn main() -> Result<()> { tasks.set_view_depth(depth); } _ => { - tasks.filter_or_create(pos, &remaining).map(|id| tasks.move_to(Some(id))); + tasks.filter_or_create(pos, &remaining) + .map(|id| tasks.move_to(Some(id))); } } }