Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
fix: don't render "0mo" output in date functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hirbod committed Oct 27, 2023
1 parent f6326ce commit 13b3547
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/app/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,8 @@ export function formatDateRelativeWithIntl(
const diffInMonths = Math.floor(diffInDays / 30.44);
if (diffInMonths === 1) {
return `${diffInMonths}${isDisplayCompleteUnit ? " month ago" : "mo"}`;
} else if (diffInMonths < 12) {
} else if (diffInMonths > 0 && diffInMonths < 12) {
// Ensure diffInMonths isn't 0
return `${diffInMonths}${isDisplayCompleteUnit ? " months ago" : "mo"}`;
}

Expand Down

0 comments on commit 13b3547

Please sign in to comment.