From f927f00659bb8b1dbdf6478b132ed8643f672679 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Thu, 9 Apr 2026 03:05:04 +0000 Subject: [PATCH 1/2] fix(date): parse RFC 2822 and RFC 3339 date strings in --date flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1156 — `date --date="Mon, 06 Apr 2026 12:00:00 +0000"` now correctly parses RFC 2822 date strings instead of returning empty output. Also adds RFC 3339 parsing support. --- crates/bashkit/src/builtins/date.rs | 35 +++++++++++++++++++ .../tests/spec_cases/bash/date.test.sh | 14 ++++++++ 2 files changed, 49 insertions(+) diff --git a/crates/bashkit/src/builtins/date.rs b/crates/bashkit/src/builtins/date.rs index 2bac1a5d..6f2dce86 100644 --- a/crates/bashkit/src/builtins/date.rs +++ b/crates/bashkit/src/builtins/date.rs @@ -148,6 +148,16 @@ fn parse_base_date(s: &str, now: DateTime) -> std::result::Result Date: Thu, 9 Apr 2026 03:19:18 +0000 Subject: [PATCH 2/2] chore(specs): update date test count in implementation status --- crates/bashkit/src/builtins/date.rs | 6 ++---- specs/009-implementation-status.md | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/bashkit/src/builtins/date.rs b/crates/bashkit/src/builtins/date.rs index 6f2dce86..805fc4f4 100644 --- a/crates/bashkit/src/builtins/date.rs +++ b/crates/bashkit/src/builtins/date.rs @@ -827,16 +827,14 @@ mod tests { #[tokio::test] async fn test_date_parse_rfc2822_input() { - let result = - run_date(&["+%B %d, %Y", "--date=Mon, 06 Apr 2026 12:00:00 +0000"]).await; + let result = run_date(&["+%B %d, %Y", "--date=Mon, 06 Apr 2026 12:00:00 +0000"]).await; assert_eq!(result.exit_code, 0); assert_eq!(result.stdout.trim(), "April 06, 2026"); } #[tokio::test] async fn test_date_parse_rfc2822_epoch_output() { - let result = - run_date(&["+%s", "--date=Wed, 01 Jan 2020 00:00:00 +0000"]).await; + let result = run_date(&["+%s", "--date=Wed, 01 Jan 2020 00:00:00 +0000"]).await; assert_eq!(result.exit_code, 0); assert_eq!(result.stdout.trim(), "1577836800"); } diff --git a/specs/009-implementation-status.md b/specs/009-implementation-status.md index e9b6e12d..6263ecd1 100644 --- a/specs/009-implementation-status.md +++ b/specs/009-implementation-status.md @@ -152,7 +152,7 @@ Bashkit implements IEEE 1003.1-2024 Shell Command Language. See | conditional.test.sh | 29 | `[[ ]]` conditionals, `=~` regex, BASH_REMATCH, glob `==`/`!=` | | control-flow.test.sh | 60 | if/elif/else, for, while, case `;;`/`;&`/`;;&`, select, trap ERR, `[[ =~ ]]` BASH_REMATCH, compound input redirects | | cuttr.test.sh | 39 | cut and tr commands, `-z` zero-terminated | -| date.test.sh | 37 | format specifiers, `-d` relative/compound/epoch, `-R`, `-I`, `%N` (2 skipped) | +| date.test.sh | 39 | format specifiers, `-d` relative/compound/epoch/RFC2822, `-R`, `-I`, `%N` (2 skipped) | | declare.test.sh | 23 | `declare`/`typeset`, `-i`, `-r`, `-x`, `-a`, `-p`, `-n` nameref, `-l`/`-u` case conversion | | df.test.sh | 3 | disk free reporting | | diff.test.sh | 6 | line diffs |