Fix lowercase 'a' token formatting to lowercase meridiem#984
Open
vidigoat wants to merge 1 commit into
Open
Conversation
The 'a' format token was returning the literal string 'a' instead of a lowercase meridiem indicator (am/pm). Only the uppercase 'A' token was handled in _format_localizable_token, so 'a' fell through to the default branch that returns the token unchanged. This also broke round-tripping: the parser already expects lowercase am/pm for the 'a' token, but formatting produced 'a' instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
aformat token returns the literal stringainstead of a lowercase meridiem indicator (am/pm)._format_localizable_tokenonly handles the uppercaseAtoken, soafalls through to the default branch that returns the token unchanged. Theatoken is documented and registered in the token regex, and the parser side already treats it as a lowercase meridiem, so formatting and parsing were inconsistent and a value formatted withacould not be round-tripped:previously failed because the formatted string contained a literal
arather thanpm.This mirrors the existing
Abranch and lowercases the result for theatoken. Added a regression test alongside the existingtest_am_pm.