diff --git a/crates/nu-command/src/strings/str_/join.rs b/crates/nu-command/src/strings/str_/join.rs index e500da8343..12b2858e1e 100644 --- a/crates/nu-command/src/strings/str_/join.rs +++ b/crates/nu-command/src/strings/str_/join.rs @@ -1,3 +1,4 @@ +use chrono::Datelike; use nu_engine::command_prelude::*; use nu_protocol::{shell_error::io::IoError, Signals}; @@ -109,9 +110,14 @@ fn run( Value::Error { error, .. } => { return Err(*error); } - // Hmm, not sure what we actually want. - // `to_expanded_string` formats dates as human readable which feels funny. - Value::Date { val, .. } => write!(buffer, "{val:?}").map_err(&from_io_error)?, + Value::Date { val, .. } => { + let date_str = if val.year() >= 0 { + val.to_rfc2822() + } else { + val.to_rfc3339() + }; + write!(buffer, "{date_str}").map_err(&from_io_error)? + } value => write!(buffer, "{}", value.to_expanded_string("\n", &config)) .map_err(&from_io_error)?, }