Skip to content

Commit 420a098

Browse files
refactor: Simplify conditional logic in BuildRelative method of TimeAgoTagHelper
1 parent c7cbb00 commit 420a098

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/XtremeIdiots.Portal.Web/Helpers/TimeAgoTagHelper.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ private static string BuildRelative(DateTime dateTimeUtc)
5656
return future ? $"in {Math.Round(minutes)} minutes" : $"{Math.Round(minutes)} minutes ago";
5757
if (minutes < 90)
5858
return future ? "in an hour" : "an hour ago";
59-
if (hours < 24)
60-
return future ? $"in {Math.Round(hours)} hours" : $"{Math.Round(hours)} hours ago";
61-
if (hours < 42)
62-
return future ? "in a day" : "a day ago";
63-
return days < 30
59+
return hours < 24
60+
? future ? $"in {Math.Round(hours)} hours" : $"{Math.Round(hours)} hours ago"
61+
: hours < 42
62+
? future ? "in a day" : "a day ago"
63+
: days < 30
6464
? future ? $"in {Math.Round(days)} days" : $"{Math.Round(days)} days ago"
6565
: days < 45
6666
? future ? "in a month" : "a month ago"

0 commit comments

Comments
 (0)