summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Zhang <kweizh@gmail.com>2024-03-22 01:19:59 +0800
committerWei Zhang <kweizh@gmail.com>2024-03-22 23:59:12 +0800
commit4310bf814cdede5daa5181fdf4588d3f65d771f8 (patch)
treea5fbdbf0f8e0e1924781960f2e0784916da204f3
parent7ad1be8cda1999eaae308b3e28021fb2fb256664 (diff)
:construction: temporarily allow deprecated durationv1.1.0
will fix in next release Signed-off-by: Wei Zhang <kweizh@gmail.com>
-rw-r--r--src/meta/date.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/meta/date.rs b/src/meta/date.rs
index e7ded16..007023c 100644
--- a/src/meta/date.rs
+++ b/src/meta/date.rs
@@ -34,6 +34,7 @@ impl From<&Metadata> for Date {
impl Date {
pub fn render(&self, colors: &Colors, flags: &Flags) -> ColoredString {
let now = Local::now();
+ #[allow(deprecated)]
let elem = match self {
&Date::Date(modified) if modified > now - Duration::hours(1) => Elem::HourOld,
&Date::Date(modified) if modified > now - Duration::days(1) => Elem::DayOld,
@@ -46,6 +47,7 @@ impl Date {
let locale = current_locale();
if let Date::Date(val) = self {
+ #[allow(deprecated)]
match &flags.date {
DateFlag::Date => val.format("%c").to_string(),
DateFlag::Locale => val.format_localized("%c", locale).to_string(),
@@ -119,6 +121,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_an_hour_old_file_color.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - chrono::Duration::seconds(4);
let success = cross_platform_touch(&file_path, &creation_date)
@@ -146,6 +149,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_a_day_old_file_color.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - chrono::Duration::hours(4);
let success = cross_platform_touch(&file_path, &creation_date)
@@ -173,6 +177,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_a_several_days_old_file_color.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - chrono::Duration::days(2);
let success = cross_platform_touch(&file_path, &creation_date)
@@ -200,6 +205,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_with_relative_date.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - chrono::Duration::days(2);
let success = cross_platform_touch(&file_path, &creation_date)
@@ -285,6 +291,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_iso_format_year_old.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - Duration::days(400);
let success = cross_platform_touch(&file_path, &creation_date)
.unwrap()