From 0fedd15a61d79735552137f9cb008a58f4554e20 Mon Sep 17 00:00:00 2001 From: Kevin Cui Date: Tue, 15 Sep 2020 21:11:43 +0200 Subject: Replace HumanTime::to_text_en by HumanTime --- src/renderer.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/renderer.rs b/src/renderer.rs index f39cc64..1192565 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -1,6 +1,6 @@ use actix_web::http::StatusCode; use chrono::{DateTime, Duration, Utc}; -use chrono_humanize::{Accuracy, HumanTime, Tense}; +use chrono_humanize::{HumanTime}; use maud::{html, Markup, PreEscaped, DOCTYPE}; use std::time::SystemTime; use strum::IntoEnumIterator; @@ -913,13 +913,7 @@ fn humanize_systemtime(src_time: Option) -> Option { src_time .and_then(|std_time| SystemTime::now().duration_since(std_time).ok()) .and_then(|from_now| Duration::from_std(from_now).ok()) - .map(|duration| { - if duration < Duration::seconds(11) { - "now".to_string() - } else { - HumanTime::from(duration).to_text_en(Accuracy::Rough, Tense::Past) - } - }) + .map(|duration| { format!("{}", HumanTime::from(-duration))}) } /// Renders an error on the webpage -- cgit v1.2.3