File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
CompatBot/Utils/Extensions Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff 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 ( ) ;
You can’t perform that action at this time.
0 commit comments