diff options
author | Kevin Cui <krazycavin@gmail.com> | 2020-09-15 19:11:43 +0000 |
---|---|---|
committer | Kevin Cui <krazycavin@gmail.com> | 2020-09-15 19:11:43 +0000 |
commit | 0fedd15a61d79735552137f9cb008a58f4554e20 (patch) | |
tree | fc18217d8bf998013eda9f8563c45dbd12aa6304 | |
parent | Fix wrong use of format (diff) | |
download | miniserve-0fedd15a61d79735552137f9cb008a58f4554e20.tar.gz miniserve-0fedd15a61d79735552137f9cb008a58f4554e20.zip |
Replace HumanTime::to_text_en by HumanTime
Diffstat (limited to '')
-rw-r--r-- | src/renderer.rs | 10 |
1 files changed, 2 insertions, 8 deletions
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<SystemTime>) -> Option<String> { 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 |