Skip to content

Commit 30acfc2

Browse files
committed
Merge branch 'vnext'
2 parents f0ec66b + d2a7cef commit 30acfc2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

CompatBot/Utils/Extensions/DateTimeEx.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public static class DateTimeEx
77

88
public static string AsShortTimespan(this TimeSpan timeSpan)
99
{
10+
var totalSecondsInt = (int)timeSpan.TotalSeconds;
1011
var totalMinutesInt = (int)timeSpan.TotalMinutes;
1112
var totalHoursInt = (int)timeSpan.TotalHours;
1213
var totalDays = timeSpan.TotalDays;
@@ -35,8 +36,8 @@ public static string AsShortTimespan(this TimeSpan timeSpan)
3536
result += hours + "h ";
3637
if (minutes > 0)
3738
result += minutes + "m ";
38-
if (result is not { Length: >0})
39-
result = (int)timeSpan.TotalSeconds + "s";
39+
if (result is not { Length: >0} && totalSecondsInt > 0)
40+
result = totalSecondsInt + "s";
4041
if (result is not { Length: > 0 })
4142
result = (int)timeSpan.TotalMilliseconds + "ms";
4243
return result.TrimEnd();

0 commit comments

Comments
 (0)