Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhanced humanize() #1199

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

enhanced humanize() #1199

wants to merge 2 commits into from

Conversation

psyuktha
Copy link
Contributor

Pull Request Checklist

  • 🧪 Added tests for changed code.
  • 🛠️ All tests pass when run locally (run tox or make test to find out!).
  • 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
  • 📚 Updated documentation for changed code.
  • ⏩ Code is up-to-date with the master branch.

Description of Changes

This PR updates the humanize functionality in the arrow library to provide more specific relative time outputs, such as "Yesterday" and "Tomorrow," instead of the generic "a day ago" or "in a day" when the difference is exactly one day as stated in the issue #1125 . This update enhances readability and user experience by providing more natural language responses for day-to-day time differences.

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (403c29f) to head (cd878fb).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1199   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         2324      2329    +5     
  Branches       357       359    +2     
=========================================
+ Hits          2324      2329    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@psyuktha
Copy link
Contributor Author

@krisfremen could you review the changes?

Copy link
Member

@krisfremen krisfremen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will unfortunately require changes and updates in all of the locales, as we can't simply hard code it to an English string without using the locales.

This breaks all other locales currently:

>>> arrow.arrow.Arrow.now().shift(days=1).humanize(locale="mk")
'Yesterday'

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.

2 participants