summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2023-07-30 14:18:19 -0400
committerJeff Zhao <jeff.no.zhao@gmail.com>2023-07-30 14:18:19 -0400
commit66bd93386f7c741aaa3a98ddd619efd0107f8b22 (patch)
tree592035d81d8a3004758a551b7e075b63344ef120
parent5e6e09e14f9e7c58d610646bd48efac8d6f8dd2f (diff)
parent713bd70d88eff0cb5130c2661fdf84fb2d09ab2a (diff)
Merge branch 'main' of github.com:kamiyaa/joshuto
-rw-r--r--README.md2
-rw-r--r--src/main.rs9
-rw-r--r--src/ui/widgets/tui_footer.rs4
-rw-r--r--src/util/format.rs2
4 files changed, 13 insertions, 4 deletions
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
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<PathBuf> = 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<chrono::offset::Utc> = mtime.into();
+ let datetime: chrono::DateTime<chrono::offset::Local> = mtime.into();
datetime.format(MTIME_FORMATTING).to_string()
}