-
-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: strftime getSuffix works for all dates
As written, the strftime module's `getSuffix` method (responsible for returning a date's ordinal string) works correctly for all dates in a month _except_ 11, 12, and 13. The existing code would return a string based on the last digit of the date. In American English, these three dates use the `th` suffix rather than `st`, `nd`, or `rd`. This refactor/bug fix draws inspiration from Rails' ActiveSupport ordinal inflector: https://github.com/rails/rails/blob/main/activesupport/lib/active_support/locale/en.rb The Ruby code above is designed to work with any number, so the bug fix to this library is simpler. The test suite is also updated with additional examples to verify the correctness of these changes.
- Loading branch information
1 parent
e401a30
commit 0b4e2a9
Showing
2 changed files
with
47 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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