diff --git a/src/uu/date/src/format_modifiers.rs b/src/uu/date/src/format_modifiers.rs index 8c18c3cca71..daa77f29f55 100644 --- a/src/uu/date/src/format_modifiers.rs +++ b/src/uu/date/src/format_modifiers.rs @@ -356,9 +356,9 @@ fn apply_modifiers( width }; - // Handle width smaller than result: strip default padding to fit + // When the requested width is narrower than the default formatted width, GNU first removes default padding and then reapplies the requested width. if effective_width > 0 && effective_width < result.len() { - return Ok(strip_default_padding(&result)); + result = strip_default_padding(&result); } // Strip default padding when switching pad characters on numeric fields diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index de347a17d7a..e2a2821322a 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -1827,7 +1827,6 @@ fn test_date_parenthesis_comment() { } #[test] -#[ignore = "https://github.com/uutils/coreutils/issues/11660 — GNU date pads to the requested width when it is narrower than the default (e.g. `%02j` on day-1 -> `01`); uutils strips leading zeros to `1`."] fn test_date_strftime_narrow_width_on_wide_default() { // `%j` has a default width of 3. Requesting `%02j` on day 1 should yield `01`. // uutils currently yields `1`.