arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.71k stars 673 forks source link

fix edge case for humanize month #894

Closed yiransii closed 3 years ago

yiransii commented 3 years ago

Pull Request Checklist

Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

Description of Changes

Added edge case handling for the humanize method to describe the delta of both 30 days and 31 days as "1 month".

For instance,

dt=arrow.get("2020-11-08T15:12:18.911919+00:00")
later=dt.shift(months=+1)
print(dt.humanize(later))
print(later.humanize(dt))

should print

a month ago
in a month

Closes: #749

codecov[bot] commented 3 years ago

Codecov Report

Merging #894 (0e76c3e) into master (e521f27) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #894   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         1817      1819    +2     
  Branches       320       321    +1     
=========================================
+ Hits          1817      1819    +2     
Impacted Files Coverage Δ
arrow/arrow.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e521f27...0e76c3e. Read the comment docs.

systemcatch commented 3 years ago

Hey @yiransii I'll close this for now, let me know if you want to take it up again.