miller/pkg/bifs
John Kerl 72ffcb3414
Support %a %A %e %h %c %x %X in strptime (#1518) (#2179)
Miller's strftime delegates to the full-featured lestrrat-go/strftime
library, but strptime uses an in-tree fork of a small subset-only
package, so strftime output couldn't always be parsed back by
strptime with the same format string. This adds the format codes
needed to round-trip common formats like "%a %b %e %T %Y":

* %a / %A (weekday name) and %h (alias of %b): straightforward
  formatMap entries, same pattern as the existing %b/%B.
* %e (space-padded day of month): needed dedicated width-detection
  logic, since %e's own optional leading pad space is otherwise
  indistinguishable from a literal separator space when the code
  searches for the next literal text to bound a field -- this was
  the root cause of the round-trip failure in the linked issue.
* %c, %x, %X: shorthand aliases (expanding to %a %b %e %H:%M:%S %Y,
  %m/%d/%y, and %H:%M:%S respectively), same mechanism already used
  for %T/%D/%F/%R/%r.

Also documents the %D/%F/%r/%R/%T shorthands in the strptime table
in reference-dsl-time.md.in, which were already supported but
missing from the docs -- this was the exact confusion reported in
the discussion linked from #1518.

Round-trip tests added in pkg/bifs/datetime_test.go assert
strptime(strftime(t, fmt), fmt) == t across the newly-supported
formats, plus table-driven cases in
pkg/pbnjay-strptime/strptime_test.go covering %e's edge cases
(padded/unpadded single digit, double digit, adjacent to another
code with no separator, at end of string).

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-08 16:42:03 -04:00
..
arithmetic.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
arithmetic_test.go Strip dead code from pkg/ (#2121) 2026-07-01 19:32:13 -04:00
base.go Strip dead code from pkg/ (#2121) 2026-07-01 19:32:13 -04:00
base64.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
base64_test.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
bits.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
bits_test.go The package version must match the major tag version (#1654) 2024-09-20 12:10:11 -04:00
booleans.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
cmp.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
collections.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
collections_test.go Add hasvalue builtin function (#2026) 2026-04-08 08:33:12 -04:00
datetime.go Lint round 5+6: staticcheck and errcheck to zero (#2130) 2026-07-03 11:42:08 -04:00
datetime_test.go Support %a %A %e %h %c %x %X in strptime (#1518) (#2179) 2026-07-08 16:42:03 -04:00
dispositions_test.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
hashing.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
hashing_test.go The package version must match the major tag version (#1654) 2024-09-20 12:10:11 -04:00
hex.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
mathlib.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00
percentiles.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
random.go Next batch of lint fixes (#2108) 2026-06-28 17:36:36 -04:00
regex.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
relative_time.go Lint round 5+6: staticcheck and errcheck to zero (#2130) 2026-07-03 11:42:08 -04:00
sparkline.go Add sparkline DSL function and mlr sparkline verb (#166) (#2177) 2026-07-07 15:47:01 -04:00
sparkline_test.go Add sparkline DSL function and mlr sparkline verb (#166) (#2177) 2026-07-07 15:47:01 -04:00
stats.go Convert if/else-if chains to typed switch statements (staticcheck QF1003) (#2112) 2026-06-28 18:27:42 -04:00
stats_test.go Performance and style fixes (#1981) 2026-02-18 09:19:31 -05:00
strings.go DSL format function: support 1-based positional placeholders like {1} (#1650) (#2160) 2026-07-06 15:15:33 -04:00
strings_test.go DSL format function: support 1-based positional placeholders like {1} (#1650) (#2160) 2026-07-06 15:15:33 -04:00
system.go Add mlr mcp MCP server + agent playbook, with a --no-shell gate (#2098 PR7) (#2133) 2026-07-03 19:41:49 -04:00
types.go Add a first-class bytes type to the DSL, with b"..." literals and base64/hex codecs (#2122) 2026-07-03 11:58:44 -04:00