From 5266ff2da6abde6618894cdb7873f9d92714c83e Mon Sep 17 00:00:00 2001 From: Asifur Rahaman Meeru Date: Wed, 26 Aug 2026 22:15:57 +0600 Subject: [PATCH] fix(offset): accept MEZ, MESZ, MEST and KST abbreviations The table is meant to cover the same abbreviations GNU date supports, but these four were missing, so `date -d "2024-01-15 12:00 MEZ"` failed here while GNU accepts it. Offsets were measured against GNU coreutils: MEZ is +1, MESZ and MEST are +2, and KST is +9. Downstream this is what pushes uutils/coreutils to keep its own abbreviation table in date.rs and parse the string in fragments, which is the root of uutils/coreutils#13865. --- src/items/offset.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/items/offset.rs b/src/items/offset.rs index 71a320b..d47d7f3 100644 --- a/src/items/offset.rs +++ b/src/items/offset.rs @@ -302,9 +302,13 @@ fn timezone_name_to_offset(input: &str) -> ModalResult { "mst" => Ok("-7"), "msk" => Ok("+3"), "msd" => Ok("+4"), + "mez" => Ok("+1"), + "mesz" => Ok("+2"), + "mest" => Ok("+2"), "mdt" => Ok("-6"), "m" => Ok("+12"), "l" => Ok("+11"), + "kst" => Ok("+9"), "k" => Ok("+10"), "jst" => Ok("+9"), "ist" => Ok("+5:30"), @@ -431,6 +435,12 @@ mod tests { ("cst", off(true, 6, 0)), // negative offset ("ist", off(false, 5, 30)), // positive offset with non-zero minutes ("nst", off(true, 3, 30)), // negative offset with non-zero minutes + // Accepted by GNU date but previously missing here, which made + // `date -d "2024-01-15 12:00 MEZ"` fail (uutils/coreutils#13865). + ("mez", off(false, 1, 0)), + ("mesz", off(false, 2, 0)), + ("mest", off(false, 2, 0)), + ("kst", off(false, 9, 0)), ("z123", off(false, 0, 0)), // space separator can be ignored if immediately followed by digits (GNU date behavior) ] { let mut s = input;