mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
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> |
||
|---|---|---|
| .. | ||
| Makefile | ||
| manpage.txt | ||
| mkman.rb | ||
| mlr.1 | ||