|
|
@ -1,6 +1,6 @@ |
|
|
|
use std::{fs::metadata, path::PathBuf, str::FromStr};
|
|
|
|
|
|
|
|
use chrono::{DateTime, Datelike, Local, Timelike};
|
|
|
|
use chrono::{DateTime, Datelike, Local};
|
|
|
|
|
|
|
|
use crate::error::ShellError;
|
|
|
|
|
|
|
@ -69,14 +69,9 @@ fn format_filesize(filesize: u64) -> String { |
|
|
|
fn format_date(date: DateTime<Local>) -> String {
|
|
|
|
let now: DateTime<Local> = Local::now();
|
|
|
|
if date.day() != now.day() || date.month() != now.month() || date.year() != now.year() {
|
|
|
|
format!("{}-{:02}-{:02}", date.year(), date.month(), date.day())
|
|
|
|
date.format("%F").to_string()
|
|
|
|
} else {
|
|
|
|
format!(
|
|
|
|
"{:02}:{:02}:{:02}",
|
|
|
|
date.hour(),
|
|
|
|
date.minute(),
|
|
|
|
date.second()
|
|
|
|
)
|
|
|
|
date.format("%T").to_string()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|