Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/uu/date/src/format_modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/by-util/test_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Loading