Skip to content

feat: add time_format config option for 12h AM/PM timestamps - #34

Merged
fdaviddpt merged 1 commit into
mainfrom
feat/time-format-with-tests
Apr 25, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
feat/time-format-with-tests

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Summary

Adds a time_format config option ("24h" default, "12h" available) to control timestamp style in daily memory logs.

Changes

  • save-session.sh: reads time_format from config, uses %-I:%M %p for 12h or %H:%M for 24h
  • save-session.sh: header validation regex expanded to accept both 14:32 and 2:32 PM
  • config.example.json: documents new option with 24h default
  • 10 new tests: config presence, format output, regex acceptance (24h, 12h PM, 12h AM, double-digit hour), rejection of malformed headers, default fallback

Portability

Verified %-I (no-pad hour) works on both macOS BSD date and GNU date.

Inspired by @josemoreno801-netizen's PR #25 — same feature, rebuilt on current main with tests. Supersedes #25.

Full suite: 220 passed, 99% coverage.

Introduces a top-level time_format config key controlling timestamp
style in save-session output:

- "24h" (default, backward compatible) — produces 14:32
- "12h" — produces 2:32 PM

Changes:
- save-session.sh: read time_format config, use %-I:%M %p for 12h
- save-session.sh: expand header validation regex to accept both formats
- config.example.json: document new option with 24h default
- 10 new tests: config presence, format output, regex acceptance for
  24h/12h/AM/PM/double-digit, rejection of garbage, default fallback

Inspired by josemoreno801-netizen's PR #25. Supersedes #25.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit 8c56089 into main Apr 25, 2026
fdaviddpt pushed a commit that referenced this pull request Apr 25, 2026
Was added in PR #34 but missing from the configuration documentation.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt deleted the feat/time-format-with-tests branch September 26, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant