From 9d1a0b2ca8616af3eefb2a26b6f77a62420ecc8a Mon Sep 17 00:00:00 2001 From: pato-pan <131620424+pato-pan@users.noreply.github.com> Date: Sun, 30 Jul 2023 12:56:27 -0400 Subject: Update README.md (#382) docs/image_previews.md doesn't exist. Perhaps a link to the folder or the readme of the folder would be more appropriate? --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3812f7b..552377a 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ Please create an issue :) - Ctrl/Shift/Alt support - Bulk rename - File previews - - See [Image previews](/docs/image_previews.md) for more details + - See [Image previews](/docs/image_previews) for more details - Exit to current directory - Asynch File IO (cut/copy/paste) - Custom colors/theme -- cgit v1.2.3 From 713bd70d88eff0cb5130c2661fdf84fb2d09ab2a Mon Sep 17 00:00:00 2001 From: Lzzzzzt <101313294+Lzzzzzt@users.noreply.github.com> Date: Mon, 31 Jul 2023 00:58:07 +0800 Subject: mtime will display with local timezone (#384) --- src/main.rs | 9 +++++++++ src/ui/widgets/tui_footer.rs | 4 ++-- src/util/format.rs | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3e2b8bc..03bf646 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,6 +77,15 @@ lazy_static! { static ref HOME_DIR: Option = dirs_next::home_dir(); static ref USERNAME: String = whoami::username(); static ref HOSTNAME: String = whoami::hostname(); + + static ref TIMEZONE_STR: String = { + let offset = chrono::Local::now().offset().local_minus_utc() / 3600; + if offset.is_positive() { + format!(" UTC+{} ", offset.abs()) + } else { + format!(" UTC-{} ", offset.abs()) + } + }; } #[derive(Clone, Debug, StructOpt)] diff --git a/src/ui/widgets/tui_footer.rs b/src/ui/widgets/tui_footer.rs index adfe90d..dc42ee6 100644 --- a/src/ui/widgets/tui_footer.rs +++ b/src/ui/widgets/tui_footer.rs @@ -8,7 +8,7 @@ use crate::config::option::TabDisplayOption; use crate::fs::{JoshutoDirList, LinkType}; use crate::util::format; use crate::util::unix; -use crate::THEME_T; +use crate::{THEME_T, TIMEZONE_STR}; pub struct TuiFooter<'a> { dirlist: &'a JoshutoDirList, @@ -73,7 +73,7 @@ impl<'a> Widget for TuiFooter<'a> { Span::raw(format!("{}/{}", i + 1, self.dirlist.len())), Span::raw(" "), Span::raw(mtime_str), - Span::raw(" UTC "), + Span::raw(TIMEZONE_STR.as_str()), Span::raw(size_str), Span::raw(" "), Span::styled( diff --git a/src/util/format.rs b/src/util/format.rs index cd73605..0c515bb 100644 --- a/src/util/format.rs +++ b/src/util/format.rs @@ -23,6 +23,6 @@ pub fn file_size_to_string(file_size: u64) -> String { pub fn mtime_to_string(mtime: time::SystemTime) -> String { const MTIME_FORMATTING: &str = "%Y-%m-%d %H:%M"; - let datetime: chrono::DateTime = mtime.into(); + let datetime: chrono::DateTime = mtime.into(); datetime.format(MTIME_FORMATTING).to_string() } -- cgit v1.2.3