@@ -32,15 +32,20 @@ function CustomChat.GetLanguageText( id )
32
32
return language .GetPhrase ( " custom_chat." .. id )
33
33
end
34
34
35
+ local year = 60 * 60 * 24 * 365
36
+ local month = 60 * 60 * 24 * 30
37
+ local day = 60 * 60 * 24
38
+ local hour = 60 * 60
39
+ local minute = 60
35
40
function CustomChat .NiceTime ( time )
36
41
local L = CustomChat .GetLanguageText
37
42
38
43
local timeUnits = {
39
- { value = math.floor ( time / ( 60 * 60 * 24 * 30 * 12 ) ), name = " time.years" },
40
- { value = math.floor ( time / ( 60 * 60 * 24 * 30 ) ) % 12 , name = " time.months" },
41
- { value = math.floor ( time / ( 60 * 60 * 24 ) ) % 30 , name = " time.days" },
42
- { value = math.floor ( time / ( 60 * 60 ) ) % 24 , name = " time.hours" },
43
- { value = math.floor ( time / 60 ) % 60 , name = " time.minutes" },
44
+ { value = math.floor ( time / year ), name = " time.years" },
45
+ { value = math.floor ( time / month ) % 12 , name = " time.months" },
46
+ { value = math.floor ( time / day ) % 30 , name = " time.days" },
47
+ { value = math.floor ( time / hour ) % 24 , name = " time.hours" },
48
+ { value = math.floor ( time / minute ) % 60 , name = " time.minutes" },
44
49
{ value = time % 60 , name = " time.seconds" }
45
50
}
46
51
@@ -52,7 +57,11 @@ function CustomChat.NiceTime( time )
52
57
end
53
58
54
59
local selectedUnits = {}
55
- for i = 1 , math.min ( 2 , # nonZeroUnits ) do
60
+ local unitsToShow = 1
61
+ if time > month then
62
+ unitsToShow = 2
63
+ end
64
+ for i = 1 , math.min ( unitsToShow , # nonZeroUnits ) do
56
65
table.insert ( selectedUnits , nonZeroUnits [i ] )
57
66
end
58
67
0 commit comments