From c9288af025e569c7eccc3b283d2a38e144c3440d Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Wed, 2 Dec 2026 11:06:33 +0900 Subject: [PATCH 1/5] Share datetime parsing across UI tests --- src/app.rs | 9 +-------- src/main.rs | 3 +++ src/pages/object_detail.rs | 9 +-------- src/pages/object_list.rs | 9 +-------- src/pages/object_preview.rs | 9 +-------- src/test_support.rs | 8 ++++++++ src/widget/copy_detail_dialog.rs | 9 +-------- 7 files changed, 16 insertions(+), 40 deletions(-) create mode 100644 src/test_support.rs diff --git a/src/app.rs b/src/app.rs index 4303b6c..5e446e5 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1077,7 +1077,6 @@ impl App { mod tests { use std::rc::Rc; - use chrono::{DateTime, Local, NaiveDateTime}; use ratatui::{ backend::TestBackend, crossterm::event::{KeyCode, KeyEvent}, @@ -1085,6 +1084,7 @@ mod tests { }; use super::*; + use crate::test_support::parse_datetime; use crate::{ client::AddressingStyle, event::{ @@ -1558,13 +1558,6 @@ mod tests { } } - fn parse_datetime(s: &str) -> DateTime { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") - .unwrap() - .and_local_timezone(Local) - .unwrap() - } - fn object_file_item(name: &str) -> ObjectItem { ObjectItem::File { name: name.to_string(), diff --git a/src/main.rs b/src/main.rs index 0641da5..b75d986 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,9 @@ mod run; mod util; mod widget; +#[cfg(test)] +mod test_support; + use clap::{Parser, ValueEnum}; use std::{path::PathBuf, sync::Mutex}; use tracing_subscriber::fmt::time::ChronoLocal; diff --git a/src/pages/object_detail.rs b/src/pages/object_detail.rs index 4c204c5..e4630c6 100644 --- a/src/pages/object_detail.rs +++ b/src/pages/object_detail.rs @@ -821,7 +821,7 @@ mod tests { use crate::set_cells; use super::*; - use chrono::{DateTime, Local, NaiveDateTime}; + use crate::test_support::parse_datetime; use ratatui::{backend::TestBackend, buffer::Buffer, crossterm::event::KeyCode, Terminal}; #[test] @@ -1361,13 +1361,6 @@ mod tests { Sender::new(tx) } - fn parse_datetime(s: &str) -> DateTime { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") - .unwrap() - .and_local_timezone(Local) - .unwrap() - } - fn fixtures() -> (Vec, FileDetail, Vec, ObjectKey) { let items = vec![ object_file_item("file1", 1024 + 10, "2024-01-02 13:01:02"), diff --git a/src/pages/object_list.rs b/src/pages/object_list.rs index 9aac7e8..3bcf78a 100644 --- a/src/pages/object_list.rs +++ b/src/pages/object_list.rs @@ -1003,7 +1003,7 @@ mod tests { use crate::set_cells; use super::*; - use chrono::NaiveDateTime; + use crate::test_support::parse_datetime; use ratatui::{ backend::TestBackend, buffer::Buffer, @@ -1405,13 +1405,6 @@ mod tests { Sender::new(tx) } - fn parse_datetime(s: &str) -> DateTime { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") - .unwrap() - .and_local_timezone(Local) - .unwrap() - } - fn object_dir_item(name: &str) -> ObjectItem { ObjectItem::Dir { name: name.to_string(), diff --git a/src/pages/object_preview.rs b/src/pages/object_preview.rs index 97a7287..faf178e 100644 --- a/src/pages/object_preview.rs +++ b/src/pages/object_preview.rs @@ -459,7 +459,7 @@ mod tests { use crate::set_cells; use super::*; - use chrono::{DateTime, Local, NaiveDateTime}; + use crate::test_support::parse_datetime; use ratatui::{backend::TestBackend, buffer::Buffer, style::Color, Terminal}; fn object(ss: &[&str]) -> RawObject { @@ -590,13 +590,6 @@ mod tests { Ok(()) } - fn parse_datetime(s: &str) -> DateTime { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") - .unwrap() - .and_local_timezone(Local) - .unwrap() - } - fn setup_terminal() -> Result, core::convert::Infallible> { let backend = TestBackend::new(30, 10); let mut terminal = Terminal::new(backend)?; diff --git a/src/test_support.rs b/src/test_support.rs new file mode 100644 index 0000000..13ca09c --- /dev/null +++ b/src/test_support.rs @@ -0,0 +1,8 @@ +use chrono::{DateTime, Local, NaiveDateTime}; + +pub fn parse_datetime(s: &str) -> DateTime { + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") + .unwrap() + .and_local_timezone(Local) + .unwrap() +} diff --git a/src/widget/copy_detail_dialog.rs b/src/widget/copy_detail_dialog.rs index 3edd49d..9c8da8b 100644 --- a/src/widget/copy_detail_dialog.rs +++ b/src/widget/copy_detail_dialog.rs @@ -355,11 +355,11 @@ impl CopyDetailDialog { #[cfg(test)] mod tests { - use chrono::{DateTime, Local, NaiveDateTime}; use crate::set_cells; use super::*; + use crate::test_support::parse_datetime; #[test] fn test_render_copy_detail_dialog() { @@ -429,11 +429,4 @@ mod tests { object_url: "https://bucket-1.s3.ap-northeast-1.amazonaws.com/file.txt".to_string(), } } - - fn parse_datetime(s: &str) -> DateTime { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") - .unwrap() - .and_local_timezone(Local) - .unwrap() - } } From 73497068948f3825bd695690b7166c566a479c68 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Wed, 2 Dec 2026 11:08:09 +0900 Subject: [PATCH 2/5] Use Jiff for S3 object timestamps --- Cargo.lock | 1 + Cargo.toml | 1 + src/client.rs | 97 ++++++++++++++++++++++---------------- src/format.rs | 6 +-- src/object.rs | 12 ++--- src/pages/object_list.rs | 4 +- src/test_support.rs | 8 ++-- src/widget/text_preview.rs | 2 +- 8 files changed, 75 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5620d5..c082e85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5154,6 +5154,7 @@ dependencies = [ "indexmap 2.14.2", "infer", "itsuki", + "jiff 1.0.3", "laurier", "once_cell", "open", diff --git a/Cargo.toml b/Cargo.toml index 5410cd2..93ce04c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,6 +59,7 @@ image = { version = "0.25.10", default-features = false, features = [ indexmap = { version = "2.14.2", features = ["serde"] } infer = { version = "0.22.0", default-features = false } itsuki = "0.2.1" +jiff = "1.0.3" laurier = "0.4.0" once_cell = "1.21.4" open = "5.4.5" diff --git a/src/client.rs b/src/client.rs index 5a100be..029b8eb 100644 --- a/src/client.rs +++ b/src/client.rs @@ -18,7 +18,7 @@ use aws_smithy_http_client::{ tls::{self, rustls_provider::CryptoMode}, ConnectorBuilder, }; -use chrono::TimeZone; +use jiff::{tz::TimeZone, Timestamp, ZonedDateTime}; use crate::{ ca_bundle, @@ -192,7 +192,7 @@ impl Client { let dirs = objects_output_to_dirs(&self.region, bucket, &output); dirs_vec.push(dirs); - let files = objects_output_to_files(&self.region, bucket, &output); + let files = objects_output_to_files(&self.region, bucket, &output)?; files_vec.push(files); token = output.next_continuation_token().map(String::from); @@ -223,7 +223,7 @@ impl Client { let name = name.to_owned(); let size_byte = output.content_length().unwrap() as usize; - let last_modified = convert_datetime(output.last_modified().unwrap()); + let last_modified = convert_datetime(output.last_modified().unwrap())?; let e_tag = output.e_tag().unwrap().trim_matches('"').to_string(); let http_headers = object_http_headers(&output); let user_metadata = output @@ -265,26 +265,25 @@ impl Client { .await; let output = result.map_err(|e| AppError::new("Failed to load object versions", e))?; - let versions = output + output .versions() .iter() .filter(|v| v.key() == Some(key)) .map(|v| { let version_id = v.version_id().map(String::from); let size_byte = v.size().unwrap() as usize; - let last_modified = convert_datetime(v.last_modified().unwrap()); + let last_modified = convert_datetime(v.last_modified().unwrap())?; let e_tag = v.e_tag().unwrap().trim_matches('"').to_string(); let is_latest = v.is_latest().unwrap(); - FileVersion { + Ok(FileVersion { version_id, size_byte, last_modified, e_tag, is_latest, - } + }) }) - .collect(); - Ok(versions) + .collect() } pub async fn download_object( @@ -437,36 +436,36 @@ fn objects_output_to_files( region: &str, bucket: &str, output: &ListObjectsV2Output, -) -> Vec { - let objects = output.contents(); - objects - .iter() - .map(|file| { - let path = file.key().unwrap(); - let paths = parse_path(path, false); - let name = paths.last().unwrap().to_owned(); - let size_byte = file.size().unwrap() as usize; - let last_modified = convert_datetime(file.last_modified().unwrap()); +) -> Result> { + let mut files = Vec::new(); + for file in output.contents() { + let path = file.key().unwrap(); + let paths = parse_path(path, false); + let name = paths.last().unwrap().to_owned(); + if name.is_empty() { + continue; // skip dummy empty object + } + let size_byte = file.size().unwrap() as usize; + let last_modified = convert_datetime(file.last_modified().unwrap())?; - let key = file.key().unwrap().to_owned(); - let s3_uri = build_object_s3_uri(bucket, &key); - let arn = build_object_arn(bucket, &key); - let object_url = build_object_url(region, bucket, &key); - let e_tag = file.e_tag().unwrap().trim_matches('"').to_string(); + let key = file.key().unwrap().to_owned(); + let s3_uri = build_object_s3_uri(bucket, &key); + let arn = build_object_arn(bucket, &key); + let object_url = build_object_url(region, bucket, &key); + let e_tag = file.e_tag().unwrap().trim_matches('"').to_string(); - ObjectItem::File { - name, - size_byte, - last_modified, - key, - s3_uri, - arn, - object_url, - e_tag, - } - }) - .filter(|f| !f.name().is_empty()) // skip dummy empty object - .collect() + files.push(ObjectItem::File { + name, + size_byte, + last_modified, + key, + s3_uri, + arn, + object_url, + e_tag, + }); + } + Ok(files) } fn parse_path(path: &str, dir: bool) -> Vec { @@ -479,9 +478,10 @@ fn parse_path(path: &str, dir: bool) -> Vec { } } -fn convert_datetime(dt: &aws_sdk_s3::primitives::DateTime) -> chrono::DateTime { - let nanos = dt.as_nanos(); - chrono::Local.timestamp_nanos(nanos as i64) +fn convert_datetime(dt: &aws_sdk_s3::primitives::DateTime) -> Result { + let timestamp = Timestamp::from_nanosecond(dt.as_nanos()) + .map_err(|e| AppError::new("Failed to convert object timestamp", e))?; + Ok(timestamp.to_zoned_datetime(TimeZone::system())) } fn build_bucket_s3_uri(bucket: &str) -> String { @@ -510,8 +510,25 @@ fn build_object_url(region: &str, bucket: &str, key: &str) -> String { #[cfg(test)] mod tests { + use rstest::rstest; + use super::*; + #[rstest] + #[case(0, 0, "1970-01-01T00:00:00Z")] + #[case(-1, 999_999_999, "1969-12-31T23:59:59.999999999Z")] + #[case(9_500_000_000, 123_456_789, "2271-01-16T16:53:20.123456789Z")] + fn converts_object_timestamp( + #[case] seconds: i64, + #[case] nanoseconds: u32, + #[case] expected: &str, + ) { + let dt = aws_sdk_s3::primitives::DateTime::from_secs_and_nanos(seconds, nanoseconds); + let actual = convert_datetime(&dt).unwrap(); + + assert_eq!(actual.timestamp().to_string(), expected); + } + #[test] fn object_headers_preserve_values_in_display_order() { let output = HeadObjectOutput::builder() diff --git a/src/format.rs b/src/format.rs index c273bc2..5029c84 100644 --- a/src/format.rs +++ b/src/format.rs @@ -1,4 +1,4 @@ -use chrono::{DateTime, Local}; +use jiff::ZonedDateTime; pub fn format_size_byte(size_byte: usize) -> String { humansize::format_size_i(size_byte, humansize::BINARY) @@ -16,7 +16,7 @@ pub fn format_version(version: Option<&str>, fix_dynamic_values: bool) -> &str { } pub fn format_datetime( - datetime: &DateTime, + datetime: &ZonedDateTime, format_str: &str, fix_dynamic_values: bool, ) -> String { @@ -24,5 +24,5 @@ pub fn format_datetime( // use a fixed datetime if fix_dynamic_values is true return String::from("2024-01-02 13:04:05"); } - datetime.format(format_str).to_string() + datetime.strftime(format_str).to_string() } diff --git a/src/object.rs b/src/object.rs index 9cfe3a1..0e589dc 100644 --- a/src/object.rs +++ b/src/object.rs @@ -3,7 +3,7 @@ use std::{ fmt::{self, Debug, Formatter}, }; -use chrono::{DateTime, Local}; +use jiff::ZonedDateTime; #[derive(Clone, Debug)] pub struct BucketItem { @@ -24,7 +24,7 @@ pub enum ObjectItem { File { name: String, size_byte: usize, - last_modified: DateTime, + last_modified: ZonedDateTime, key: String, s3_uri: String, arn: String, @@ -55,10 +55,10 @@ impl ObjectItem { } } - pub fn last_modified(&self) -> Option> { + pub fn last_modified(&self) -> Option<&ZonedDateTime> { match self { ObjectItem::Dir { .. } => None, - ObjectItem::File { last_modified, .. } => Some(*last_modified), + ObjectItem::File { last_modified, .. } => Some(last_modified), } } } @@ -67,7 +67,7 @@ impl ObjectItem { pub struct FileDetail { pub name: String, pub size_byte: usize, - pub last_modified: DateTime, + pub last_modified: ZonedDateTime, pub e_tag: String, pub http_headers: Vec<(&'static str, String)>, pub user_metadata: BTreeMap, @@ -82,7 +82,7 @@ pub struct FileDetail { pub struct FileVersion { pub version_id: Option, pub size_byte: usize, - pub last_modified: DateTime, + pub last_modified: ZonedDateTime, pub e_tag: String, #[allow(dead_code)] pub is_latest: bool, diff --git a/src/pages/object_list.rs b/src/pages/object_list.rs index 3bcf78a..1be8b7c 100644 --- a/src/pages/object_list.rs +++ b/src/pages/object_list.rs @@ -1,6 +1,6 @@ use std::rc::Rc; -use chrono::{DateTime, Local}; +use jiff::ZonedDateTime; use laurier::highlight::highlight_matched_text; use ratatui::{ crossterm::event::KeyEvent, @@ -924,7 +924,7 @@ fn build_object_dir_line<'a>( fn build_object_file_line<'a>( name: &'a str, size_byte: usize, - last_modified: &'a DateTime, + last_modified: &'a ZonedDateTime, filter: &'a str, width: u16, ui_config: &UiConfig, diff --git a/src/test_support.rs b/src/test_support.rs index 13ca09c..30e6fc1 100644 --- a/src/test_support.rs +++ b/src/test_support.rs @@ -1,8 +1,8 @@ -use chrono::{DateTime, Local, NaiveDateTime}; +use jiff::{civil::DateTime, tz::TimeZone, ZonedDateTime}; -pub fn parse_datetime(s: &str) -> DateTime { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") +pub fn parse_datetime(s: &str) -> ZonedDateTime { + DateTime::strptime("%Y-%m-%d %H:%M:%S", s) .unwrap() - .and_local_timezone(Local) + .to_zoned_datetime(TimeZone::system()) .unwrap() } diff --git a/src/widget/text_preview.rs b/src/widget/text_preview.rs index dae22e4..68e49c2 100644 --- a/src/widget/text_preview.rs +++ b/src/widget/text_preview.rs @@ -579,7 +579,7 @@ mod tests { let detail = FileDetail { name: "preview.txt".into(), size_byte: object.bytes.len(), - last_modified: chrono::Local::now(), + last_modified: jiff::ZonedDateTime::now(), e_tag: String::new(), http_headers: Vec::new(), user_metadata: Default::default(), From dbfce464ccdac6f3d01e8bc9b85e0e77bfe16a76 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Wed, 2 Dec 2026 11:08:54 +0900 Subject: [PATCH 3/5] Use Jiff for log timestamps --- Cargo.lock | 4 ---- Cargo.toml | 2 -- src/file.rs | 9 +++++---- src/main.rs | 17 +++++++++++++++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c082e85..cf883ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1201,10 +1201,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ "iana-time-zone", - "js-sys", "num-traits", "serde", - "wasm-bindgen", "windows-link", ] @@ -5143,7 +5141,6 @@ dependencies = [ "aws-sdk-s3", "aws-smithy-http-client", "chardetng", - "chrono", "clap", "console", "crossterm 0.29.0", @@ -5772,7 +5769,6 @@ version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ - "chrono", "sharded-slab", "thread_local", "tracing-core", diff --git a/Cargo.toml b/Cargo.toml index 93ce04c..d9e16c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,6 @@ aws-sdk-s3 = { version = "1.161.0", default-features = false, features = [ ] } aws-smithy-http-client = { version = "1.5.3", default-features = false, features = ["rustls-aws-lc"] } chardetng = "1.0.0" -chrono = "0.4.45" clap = { version = "4.6.10", features = ["derive"] } console = "0.16.6" crossterm = { version = "0.29.0", features = ["event-stream"] } @@ -92,7 +91,6 @@ toml = { version = "1.2.2", default-features = false, features = [ tracing = "0.1.44" tracing-subscriber = { version = "0.3.23", default-features = false, features = [ "fmt", - "chrono", "tracing-log", ] } tui-input = { version = "0.15.5", default-features = false, features = [ diff --git a/src/file.rs b/src/file.rs index 7d96c26..65706d4 100644 --- a/src/file.rs +++ b/src/file.rs @@ -1,5 +1,5 @@ use arboard::Clipboard; -use chrono::Local; +use jiff::ZonedDateTime; use std::{ fs::{File, OpenOptions}, io::{BufWriter, Write}, @@ -20,14 +20,15 @@ pub fn save_error_log>(path: P, e: &AppError) -> Result<()> { let mut f = open_or_create_append_file(path).map_err(|e| AppError::new("Failed to open file", e))?; - let now = Local::now(); + let now = ZonedDateTime::now(); + let timestamp = now.strftime("%Y-%m-%d %H:%M:%S%.f %:z"); match &e.cause { Some(cause) => { - writeln!(f, "{} {}: {:?}", now, e.msg, cause) + writeln!(f, "{} {}: {:?}", timestamp, e.msg, cause) } None => { - writeln!(f, "{} {}", now, e.msg) + writeln!(f, "{} {}", timestamp, e.msg) } } .map_err(|e| AppError::new("Failed to write file", e)) diff --git a/src/main.rs b/src/main.rs index b75d986..bf07fb8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,8 +22,9 @@ mod widget; mod test_support; use clap::{Parser, ValueEnum}; +use jiff::ZonedDateTime; use std::{path::PathBuf, sync::Mutex}; -use tracing_subscriber::fmt::time::ChronoLocal; +use tracing_subscriber::fmt::{format::Writer, time::FormatTime}; use crate::{ app::{App, AppContext}, @@ -130,13 +131,25 @@ async fn main() -> anyhow::Result<()> { ret } +struct LocalTime; + +impl FormatTime for LocalTime { + fn format_time(&self, writer: &mut Writer<'_>) -> std::fmt::Result { + write!( + writer, + "{}", + ZonedDateTime::now().strftime("%Y-%m-%dT%H:%M:%S%.f%:z") + ) + } +} + fn initialize_debug_log(args: &Args) -> anyhow::Result<()> { if args.debug { let path = Config::debug_log_path()?; let file = open_or_create_append_file(path)?; tracing_subscriber::fmt() .with_ansi(false) - .with_timer(ChronoLocal::rfc_3339()) + .with_timer(LocalTime) .with_max_level(tracing::Level::DEBUG) .with_writer(Mutex::new(file)) .init(); From 9131c7a910ae08e6380fc2afc24071fcc2842824 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Wed, 2 Dec 2026 11:10:08 +0900 Subject: [PATCH 4/5] Validate configured date formats on startup --- src/config.rs | 62 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index b41521c..71fa02a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -4,6 +4,7 @@ use std::{ }; use anyhow::Context; +use jiff::{fmt::strtime, ZonedDateTime}; use serde::Deserialize; use smart_default::SmartDefault; use umbra::optional; @@ -148,16 +149,35 @@ impl Config { std::fs::create_dir_all(&dir)?; } let path = dir.join(CONFIG_FILE_NAME); - if path.exists() { + let config = if path.exists() { let content = std::fs::read_to_string(path)?; let mut config: OptionalConfig = toml::from_str(&content)?; if let Some(ref mut download_dir) = config.download_dir { *download_dir = Self::expand_env_vars(download_dir)?; } - Ok(config.into()) + config.into() } else { - Ok(Config::default()) + Config::default() + }; + config.validate()?; + Ok(config) + } + + fn validate(&self) -> anyhow::Result<()> { + for (key, format) in [ + ( + "ui.object_list.date_format", + &self.ui.object_list.date_format, + ), + ( + "ui.object_detail.date_format", + &self.ui.object_detail.date_format, + ), + ] { + strtime::format(format, &ZonedDateTime::UNIX_EPOCH) + .with_context(|| format!("Invalid date format for {key}"))?; } + Ok(()) } fn expand_env_vars(path: &str) -> anyhow::Result { @@ -225,6 +245,7 @@ impl Config { #[cfg(test)] mod tests { use ratatui::style::Color; + use rstest::rstest; use super::*; @@ -233,6 +254,41 @@ mod tests { config.into() } + #[test] + fn default_config_is_valid() { + Config::default().validate().unwrap(); + } + + #[rstest] + #[case("%Y-%m-%d %H:%M:%S %:z")] + #[case("%Q")] + #[case("date %%")] + fn accepts_date_formats(#[case] format: &str) { + let mut config = Config::default(); + config.ui.object_list.date_format = format.into(); + config.ui.object_detail.date_format = format.into(); + + config.validate().unwrap(); + } + + #[rstest] + #[case("object_list", "%J")] + #[case("object_detail", "%")] + fn invalid_date_format_reports_the_config_key(#[case] section: &str, #[case] format: &str) { + let config = parse_config(&format!( + r#" +[ui.{section}] +date_format = "{format}" +"# + )); + + let error = config.validate().unwrap_err(); + assert_eq!( + error.to_string(), + format!("Invalid date format for ui.{section}.date_format") + ); + } + #[test] fn theme_defaults_when_omitted() { let config = parse_config(""); From 027f1596b4404895d996a6bef2cd3f2b1ab33f55 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Wed, 2 Dec 2026 11:10:08 +0900 Subject: [PATCH 5/5] Document Jiff date format specifiers --- docs/src/configurations/config-file-format.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/configurations/config-file-format.md b/docs/src/configurations/config-file-format.md index bab895f..3291917 100644 --- a/docs/src/configurations/config-file-format.md +++ b/docs/src/configurations/config-file-format.md @@ -107,7 +107,7 @@ The default sort order of the bucket list. ### `ui.object_list.date_format` The date format of a last modified in the object list. -The format must be specified in [strftime format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). +The format must be specified using [Jiff's strftime format specifiers](https://docs.rs/jiff/latest/jiff/fmt/strtime/index.html). - type: `string` - default: `%Y-%m-%d %H:%M:%S` @@ -138,7 +138,7 @@ The default sort order of the object list. ### `ui.object_detail.date_format` The date format of a last modified in the object detail. -The format must be specified in [strftime format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html). +The format must be specified using [Jiff's strftime format specifiers](https://docs.rs/jiff/latest/jiff/fmt/strtime/index.html). - type: `string` - default: `%Y-%m-%d %H:%M:%S`