Skip to content

fix: format_P (%P) uses language-specific AM/PM values#115

Draft
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot:koan.atoomic/fix-format-P-inheritance
Draft

fix: format_P (%P) uses language-specific AM/PM values#115
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot:koan.atoomic/fix-format-P-inheritance

Conversation

@Koan-Bot
Copy link
Copy Markdown

@Koan-Bot Koan-Bot commented Apr 18, 2026

What

%P (lowercase am/pm) now returns the correct language-specific value instead of always returning English "am"/"pm".

Why

format_P in Generic.pm used the lexical @AMPM array directly — same inheritance bug pattern as format_o (#107). Language modules copy format_p into their own namespace (where it references the module's @AMPM), but format_P was never copied, so it always fell through to Generic's English array.

Affected languages: Dutch (VM/NM), Finnish (ap/ip), Hungarian (DE./DU.), Czech (dop./odp.), Chinese, Arabic, Greek, and 10+ others.

How

One-line fix: changed format_P from reimplementing the AM/PM logic with the lexical array to delegating via method dispatch ($_[0]->format_p), which correctly resolves to the language module's copied format_p.

Testing

  • Added %P test to English baseline section
  • Added Dutch test section with both AM and PM timestamps, verifying %p returns VM/NM and %P returns vm/nm
  • Full test suite passes (all files)

🤖 Generated with Claude Code


Quality Report

Changes: 2 files changed, 12 insertions(+), 2 deletions(-)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

format_P in Generic.pm used a lexical @ampm array directly, so it
always returned English "am"/"pm" regardless of language module.
Same inheritance bug pattern as format_o (PR cpan-authors#107).

Fix: delegate to format_p via method dispatch, which correctly
resolves to the language module's copied format_p function.

Affected languages with non-English AMPM: Dutch (VM/NM),
Finnish (ap/ip), Hungarian (DE./DU.), Czech (dop./odp.),
Chinese, Arabic, Greek, and 10+ others.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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