Repository navigation
fix: format the lowercase "a" meridiem token as "am"/"pm" - #1092
Open
vanshbarfiwala-lgtm wants to merge 1 commit into
Open
vanshbarfiwala-lgtm wants to merge 1 commit into
vanshbarfiwala-lgtm wants to merge 1 commit into
Conversation
The formatter registered "a" as a localizable meridiem token and the parser
accepts it, but _format_localizable_token had no branch for it, so it fell
through and was emitted literally (format("a") returned "a"). Handle "a"
alongside "A" and lowercase the result.
This branch has not been deployed
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.
DateTime.format('a')emits the literal stringainstead ofam/pm.The parser already accepts
a, so this is a format/parse asymmetry:Cause:
ais registered as a localizable meridiem token and the format regex recognizes it, but_format_localizable_tokeninsrc/pendulum/formatting/formatter.pyonly has a branch forA. Soafalls through toelse: return tokenand is echoed literally.Fix: handle
aalongsideAand lowercase the result (English day periods areAM/PM, soagivesam/pm). Added a test next to the existingtest_am_pm.