Skip to content

Commit

Permalink
fix(pretty-date): plural form when the value is 1 (#20619) (#20641)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6248d8f)

Co-authored-by: Bread Genie <63963181+BreadGenie@users.noreply.github.com>
  • Loading branch information
mergify[bot] and BreadGenie committed Apr 11, 2023
1 parent ae4f7dd commit 4d6b776
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frappe/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,15 +1335,15 @@ def pretty_date(iso_datetime):
return _("Yesterday")
elif dt_diff_days < 7.0:
return _("{0} days ago").format(cint(dt_diff_days))
elif dt_diff_days < 12:
elif dt_diff_days < 14:
return _("1 week ago")
elif dt_diff_days < 31.0:
return _("{0} weeks ago").format(cint(math.ceil(dt_diff_days / 7.0)))
elif dt_diff_days < 46:
return _("{0} weeks ago").format(dt_diff_days // 7)
elif dt_diff_days < 61.0:
return _("1 month ago")
elif dt_diff_days < 365.0:
return _("{0} months ago").format(cint(math.ceil(dt_diff_days / 30.0)))
elif dt_diff_days < 550.0:
return _("{0} months ago").format(dt_diff_days // 30)
elif dt_diff_days < 730.0:
return _("1 year ago")
else:
return "{0} years ago".format(cint(math.floor(dt_diff_days / 365.0)))
Expand Down

0 comments on commit 4d6b776

Please sign in to comment.