From f1b3749cf0865658ca165139d4de0e3de3612b32 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Wed, 29 Dec 2021 12:48:57 -0800 Subject: [PATCH] =?UTF-8?q?Fix=20#378=20=E2=80=94=20formatting=20of=20date?= =?UTF-8?q?s/times?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/user.rs | 2 +- src/utils.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bfe5731..7d77984 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -554,7 +554,7 @@ checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libreddit" -version = "0.21.3" +version = "0.21.4" dependencies = [ "askama", "async-recursion", diff --git a/Cargo.toml b/Cargo.toml index 7d212e4..f42f6ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "libreddit" description = " Alternative private front-end to Reddit" license = "AGPL-3.0" repository = "https://github.com/spikecodes/libreddit" -version = "0.21.3" +version = "0.21.4" authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"] edition = "2021" diff --git a/src/user.rs b/src/user.rs index 0bb97fb..d60e65d 100644 --- a/src/user.rs +++ b/src/user.rs @@ -94,7 +94,7 @@ async fn user(name: &str) -> Result { title: esc!(about("title")), icon: format_url(&about("icon_img")), karma: res["data"]["total_karma"].as_i64().unwrap_or(0), - created: created.format(format_description!("%b %d '%y")).unwrap_or_default(), + created: created.format(format_description!("[month repr:short] [day] '[year repr:last_two]")).unwrap_or_default(), banner: esc!(about("banner_img")), description: about("public_description"), } diff --git a/src/utils.rs b/src/utils.rs index 4e7a203..8558fd7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -642,7 +642,7 @@ pub fn time(created: f64) -> (String, String) { // If the time difference is more than a month, show full date let rel_time = if time_delta > Duration::days(30) { - time.format(format_description!("%b %d '%y")).unwrap_or_default() + time.format(format_description!("[month repr:short] [day] '[year repr:last_two]")).unwrap_or_default() // Otherwise, show relative date/time } else if time_delta.whole_days() > 0 { format!("{}d ago", time_delta.whole_days()) @@ -652,7 +652,7 @@ pub fn time(created: f64) -> (String, String) { format!("{}m ago", time_delta.whole_minutes()) }; - (rel_time, time.format(format_description!("%b %d %Y, %H:%M:%S UTC")).unwrap_or_default()) + (rel_time, time.format(format_description!("[month repr:short] [day] [year], [hour]:[minute]:[second] UTC")).unwrap_or_default()) } // val() function used to parse JSON from Reddit APIs