Skip to content

Commit b41d591

Browse files
vishakha1411cakebaker
authored andcommitted
date: fix %#P case-swap on lowercase am/pm
1 parent db9a111 commit b41d591

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/uu/date/src/format_modifiers.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ fn apply_modifiers(
337337
.all(|c| !c.is_alphabetic() || c.is_uppercase())
338338
{
339339
result = result.to_lowercase();
340-
} else {
340+
} else if !result
341+
.chars()
342+
.all(|c| !c.is_alphabetic() || c.is_lowercase())
343+
{
341344
result = result.to_uppercase();
342345
}
343346
}

tests/by-util/test_date.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,6 @@ fn test_date_input_trailing_tz_abbrev_rezones() {
18881888
}
18891889

18901890
#[test]
1891-
#[ignore = "https://github.com/uutils/coreutils/issues/11659 — GNU date treats the `#` case-swap flag as no-op on `%P` (already-lowercase alt); uutils uppercases it to `PM`."]
18921891
fn test_date_strftime_case_flag_on_alt_ampm() {
18931892
// `%P` is GNU's lowercase am/pm. `%#P` should stay lowercase in GNU; uutils flips to `PM`.
18941893
new_ucmd!()

0 commit comments

Comments
 (0)