aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvkinStanislav <76910130+IvkinStanislav@users.noreply.github.com>2022-11-10 20:40:33 +0000
committerGitHub <noreply@github.com>2022-11-10 20:40:33 +0000
commitdcfc220feb0821d66f9b31b5c9b2fb477cd40120 (patch)
tree2fa335370e29665f6d1adecc13f2e9f74652b4e1 /src
parentMerge branch 'svenstaro:master' into issue-440 (diff)
downloadminiserve-dcfc220feb0821d66f9b31b5c9b2fb477cd40120.tar.gz
miniserve-dcfc220feb0821d66f9b31b5c9b2fb477cd40120.zip
Refactoring
Diffstat (limited to '')
-rw-r--r--src/renderer.rs6
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())