diff options
author | IvkinStanislav <76910130+IvkinStanislav@users.noreply.github.com> | 2022-11-10 20:40:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 20:40:33 +0000 |
commit | dcfc220feb0821d66f9b31b5c9b2fb477cd40120 (patch) | |
tree | 2fa335370e29665f6d1adecc13f2e9f74652b4e1 | |
parent | Merge branch 'svenstaro:master' into issue-440 (diff) | |
download | miniserve-dcfc220feb0821d66f9b31b5c9b2fb477cd40120.tar.gz miniserve-dcfc220feb0821d66f9b31b5c9b2fb477cd40120.zip |
Refactoring
-rw-r--r-- | src/renderer.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index 0577b80..e4c8fcd 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -526,7 +526,7 @@ fn entry_row( } } td.date-cell { - @if let Some(modification_date) = convert_to_utc(entry.last_modification_date) { + @if let Some(modification_date) = convert_to_local(entry.last_modification_date) { span { (modification_date) " " } @@ -618,9 +618,7 @@ fn page_header(title: &str, file_upload: bool, favicon_route: &str, css_route: & } /// Converts a SystemTime object to a strings tuple (date, time) -/// Date is formatted as %e %b, e.g. Jul 12 -/// Time is formatted as %R, e.g. 22:34 -fn convert_to_utc(src_time: Option<SystemTime>) -> Option<String> { +fn convert_to_local(src_time: Option<SystemTime>) -> Option<String> { src_time .map(DateTime::<Local>::from) .map(|date_time| date_time.format("%Y-%m-%d %H:%M:%S %:z").to_string()) |