@quenty/time 2.4.0 → 2.4.1-canary.545.2374fb2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/package.json +2 -2
- package/src/Shared/Time.lua +122 -89
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.4.1-canary.545.2374fb2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.4.0...@quenty/time@2.4.1-canary.545.2374fb2.0) (2025-04-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.3.0...@quenty/time@2.4.0) (2024-09-25)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/time",
|
|
3
|
-
"version": "2.4.0",
|
|
3
|
+
"version": "2.4.1-canary.545.2374fb2.0",
|
|
4
4
|
"description": "Library handles time based parsing / operations. Untested. Based off of PHP's time system. Note: This library is out of date, and does not necessarily work. I recommend using os.time()",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "2374fb2b043cfbe0e9b507b3316eec46a4e353a0"
|
|
31
31
|
}
|
package/src/Shared/Time.lua
CHANGED
|
@@ -11,11 +11,24 @@
|
|
|
11
11
|
local Time = {}
|
|
12
12
|
|
|
13
13
|
-- luacheck: push ignore 631
|
|
14
|
-
local MONTH_NAMES
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
local MONTH_NAMES = {
|
|
15
|
+
"January",
|
|
16
|
+
"February",
|
|
17
|
+
"March",
|
|
18
|
+
"April",
|
|
19
|
+
"May",
|
|
20
|
+
"June",
|
|
21
|
+
"July",
|
|
22
|
+
"August",
|
|
23
|
+
"September",
|
|
24
|
+
"October",
|
|
25
|
+
"November",
|
|
26
|
+
"December",
|
|
27
|
+
}
|
|
28
|
+
local MONTH_NAMES_SHORT = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
|
|
29
|
+
local DAYS_IN_MONTH = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
|
30
|
+
local DAYS_OF_WEEK = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }
|
|
31
|
+
local DAYS_OF_WEEK_SHORT = { "Sun", "Mon", "Tues", "Weds", "Thurs", "Fri", "Sat" }
|
|
19
32
|
-- luacheck: pop
|
|
20
33
|
|
|
21
34
|
--[=[
|
|
@@ -23,7 +36,7 @@ local DAYS_OF_WEEK_SHORT = {"Sun", "Mon", "Tues", "Weds", "Thurs",
|
|
|
23
36
|
@param year number
|
|
24
37
|
@return { [number]: number }
|
|
25
38
|
]=]
|
|
26
|
-
function Time.getDaysMonthTable(year)
|
|
39
|
+
function Time.getDaysMonthTable(year: number): { [number]: number }
|
|
27
40
|
local copy = table.clone(DAYS_IN_MONTH)
|
|
28
41
|
|
|
29
42
|
if year % 4 == 0 and (year % 100 ~= 0 or year % 400 == 0) then
|
|
@@ -35,31 +48,31 @@ function Time.getDaysMonthTable(year)
|
|
|
35
48
|
return copy
|
|
36
49
|
end
|
|
37
50
|
|
|
38
|
-
function Time.getSecond(currentTime)
|
|
51
|
+
function Time.getSecond(currentTime: number): number
|
|
39
52
|
return math.floor(currentTime % 60)
|
|
40
53
|
end
|
|
41
54
|
|
|
42
|
-
function Time.getMinute(currentTime)
|
|
43
|
-
return math.floor(currentTime/60 % 60)
|
|
55
|
+
function Time.getMinute(currentTime: number): number
|
|
56
|
+
return math.floor(currentTime / 60 % 60)
|
|
44
57
|
end
|
|
45
58
|
|
|
46
|
-
function Time.getHour(currentTime)
|
|
47
|
-
return math.floor(currentTime/3600 % 24)
|
|
59
|
+
function Time.getHour(currentTime: number): number
|
|
60
|
+
return math.floor(currentTime / 3600 % 24)
|
|
48
61
|
end
|
|
49
62
|
|
|
50
|
-
function Time.getDay(currentTime)
|
|
51
|
-
return math.ceil(currentTime/60/60/24 % 365.25)
|
|
63
|
+
function Time.getDay(currentTime: number): number
|
|
64
|
+
return math.ceil(currentTime / 60 / 60 / 24 % 365.25)
|
|
52
65
|
end
|
|
53
66
|
|
|
54
|
-
function Time.getYear(currentTime)
|
|
55
|
-
return math.floor(currentTime/60/60/24/365.25 + 1970)
|
|
67
|
+
function Time.getYear(currentTime: number): number
|
|
68
|
+
return math.floor(currentTime / 60 / 60 / 24 / 365.25 + 1970)
|
|
56
69
|
end
|
|
57
70
|
|
|
58
|
-
function Time.getYearShort(currentTime)
|
|
71
|
+
function Time.getYearShort(currentTime: number): number
|
|
59
72
|
return Time.getYear(currentTime) % 100
|
|
60
73
|
end
|
|
61
74
|
|
|
62
|
-
function Time.getYearShortFormatted(currentTime)
|
|
75
|
+
function Time.getYearShortFormatted(currentTime: number): string
|
|
63
76
|
local shortYear = Time.getYearShort(currentTime)
|
|
64
77
|
if shortYear < 10 then
|
|
65
78
|
shortYear = "0" .. shortYear
|
|
@@ -67,73 +80,87 @@ function Time.getYearShortFormatted(currentTime)
|
|
|
67
80
|
return shortYear
|
|
68
81
|
end
|
|
69
82
|
|
|
70
|
-
function Time.getMonth(currentTime)
|
|
83
|
+
function Time.getMonth(currentTime: number): number?
|
|
71
84
|
local year = Time.getYear(currentTime)
|
|
72
85
|
local day = Time.getDay(currentTime)
|
|
73
86
|
|
|
74
87
|
local daysInMonth = Time.getDaysMonthTable(year)
|
|
75
88
|
|
|
76
|
-
for i=1, #daysInMonth do
|
|
89
|
+
for i = 1, #daysInMonth do
|
|
77
90
|
if day > daysInMonth[i] then
|
|
78
91
|
day = day - daysInMonth[i]
|
|
79
92
|
else
|
|
80
93
|
return i
|
|
81
94
|
end
|
|
82
95
|
end
|
|
96
|
+
|
|
97
|
+
return nil
|
|
83
98
|
end
|
|
84
99
|
|
|
85
|
-
function Time.getFormattedMonth(currentTime)
|
|
100
|
+
function Time.getFormattedMonth(currentTime: number): string
|
|
86
101
|
local month = Time.getMonth(currentTime)
|
|
87
102
|
if month < 10 then
|
|
88
|
-
month = "0"..month
|
|
103
|
+
month = "0" .. month
|
|
89
104
|
end
|
|
90
105
|
|
|
91
106
|
return month
|
|
92
107
|
end
|
|
93
108
|
|
|
94
|
-
function Time.getDayOfTheMonth(currentTime)
|
|
109
|
+
function Time.getDayOfTheMonth(currentTime: number): number?
|
|
95
110
|
local year = Time.getYear(currentTime)
|
|
96
111
|
local day = Time.getDay(currentTime)
|
|
97
112
|
|
|
98
113
|
local daysInMonth = Time.getDaysMonthTable(year)
|
|
99
114
|
|
|
100
|
-
for i=1, #daysInMonth do
|
|
115
|
+
for i = 1, #daysInMonth do
|
|
101
116
|
if day > daysInMonth[i] then
|
|
102
117
|
day = day - daysInMonth[i]
|
|
103
118
|
else
|
|
104
119
|
return day
|
|
105
120
|
end
|
|
106
121
|
end
|
|
122
|
+
|
|
123
|
+
return nil
|
|
107
124
|
end
|
|
108
125
|
|
|
109
|
-
function Time.getFormattedDayOfTheMonth(currentTime)
|
|
126
|
+
function Time.getFormattedDayOfTheMonth(currentTime: number): string
|
|
110
127
|
local dayOfTheMonth = Time.getDayOfTheMonth(currentTime)
|
|
111
128
|
|
|
112
129
|
if dayOfTheMonth < 10 then
|
|
113
|
-
dayOfTheMonth = "0"..dayOfTheMonth
|
|
130
|
+
dayOfTheMonth = "0" .. dayOfTheMonth
|
|
114
131
|
end
|
|
115
132
|
|
|
116
133
|
return dayOfTheMonth
|
|
117
134
|
end
|
|
118
135
|
|
|
119
|
-
function Time.getMonthName(currentTime)
|
|
120
|
-
|
|
136
|
+
function Time.getMonthName(currentTime: number): string
|
|
137
|
+
local month = Time.getMonth(currentTime)
|
|
138
|
+
if month == nil then
|
|
139
|
+
return "Unknown"
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
return MONTH_NAMES[month]
|
|
121
143
|
end
|
|
122
144
|
|
|
123
|
-
function Time.getMonthNameShort(currentTime)
|
|
124
|
-
|
|
145
|
+
function Time.getMonthNameShort(currentTime: number): string
|
|
146
|
+
local month = Time.getMonth(currentTime)
|
|
147
|
+
if month == nil then
|
|
148
|
+
return "???"
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
return MONTH_NAMES_SHORT[month]
|
|
125
152
|
end
|
|
126
153
|
|
|
127
|
-
function Time.getJulianDate(currentTime)
|
|
154
|
+
function Time.getJulianDate(currentTime: number)
|
|
128
155
|
local month = Time.getMonth(currentTime)
|
|
129
156
|
local year = Time.getYear(currentTime)
|
|
130
157
|
local day = Time.getDay(currentTime)
|
|
131
158
|
|
|
132
|
-
local a = (14-month) / 12
|
|
159
|
+
local a = (14 - month) / 12
|
|
133
160
|
local y = year + 4800 - a
|
|
134
161
|
local m = month + 12 * a - 3
|
|
135
162
|
|
|
136
|
-
local julianDay = day + ((153 * m + 2) / 5) + 365 * y + (y/4) - (y/100) + (y/400) - 32045
|
|
163
|
+
local julianDay = day + ((153 * m + 2) / 5) + 365 * y + (y / 4) - (y / 100) + (y / 400) - 32045
|
|
137
164
|
|
|
138
165
|
--[[local julianDay = (day
|
|
139
166
|
+ ((153 * (month + 12 * ((14 - month) / 12 ) - 3) + 2) / 5)
|
|
@@ -146,15 +173,15 @@ function Time.getJulianDate(currentTime)
|
|
|
146
173
|
return julianDay
|
|
147
174
|
end
|
|
148
175
|
|
|
149
|
-
function Time.getDayOfTheWeek(currentTime)
|
|
176
|
+
function Time.getDayOfTheWeek(currentTime: number): number
|
|
150
177
|
return math.floor(Time.getJulianDate(currentTime)) % 7
|
|
151
178
|
end
|
|
152
179
|
|
|
153
|
-
function Time.getDayOfTheWeekName(currentTime)
|
|
180
|
+
function Time.getDayOfTheWeekName(currentTime: number): string
|
|
154
181
|
return DAYS_OF_WEEK[Time.getDayOfTheWeek(currentTime)]
|
|
155
182
|
end
|
|
156
183
|
|
|
157
|
-
function Time.getDayOfTheWeekNameShort(currentTime)
|
|
184
|
+
function Time.getDayOfTheWeekNameShort(currentTime: number): string
|
|
158
185
|
return DAYS_OF_WEEK_SHORT[Time.getDayOfTheWeek(currentTime)]
|
|
159
186
|
end
|
|
160
187
|
|
|
@@ -162,7 +189,7 @@ end
|
|
|
162
189
|
@param number number
|
|
163
190
|
@return string (Like 1st, 2nd)
|
|
164
191
|
]=]
|
|
165
|
-
function Time.getOrdinalOfNumber(number)
|
|
192
|
+
function Time.getOrdinalOfNumber(number: number): string
|
|
166
193
|
local tenRemainder = number % 10
|
|
167
194
|
local hundredRemainder = number % 100
|
|
168
195
|
|
|
@@ -181,27 +208,32 @@ function Time.getOrdinalOfNumber(number)
|
|
|
181
208
|
end
|
|
182
209
|
end
|
|
183
210
|
|
|
184
|
-
function Time.getDayOfTheMonthOrdinal(currentTime)
|
|
185
|
-
|
|
211
|
+
function Time.getDayOfTheMonthOrdinal(currentTime: number): string?
|
|
212
|
+
local dayOfMonth = Time.getDayOfTheMonth(currentTime)
|
|
213
|
+
if dayOfMonth == nil then
|
|
214
|
+
return nil
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
return Time.getOrdinalOfNumber(dayOfMonth)
|
|
186
218
|
end
|
|
187
219
|
|
|
188
|
-
function Time.getFormattedSecond(currentTime)
|
|
220
|
+
function Time.getFormattedSecond(currentTime: number): string
|
|
189
221
|
local currentSecond = Time.getSecond(currentTime)
|
|
190
222
|
if currentSecond < 10 then
|
|
191
|
-
currentSecond = "0"..currentSecond
|
|
223
|
+
currentSecond = "0" .. currentSecond
|
|
192
224
|
end
|
|
193
225
|
return currentSecond
|
|
194
226
|
end
|
|
195
227
|
|
|
196
|
-
function Time.getFormattedMinute(currentTime)
|
|
228
|
+
function Time.getFormattedMinute(currentTime: number): string
|
|
197
229
|
local currentMinute = Time.getMinute(currentTime)
|
|
198
230
|
if currentMinute < 10 then
|
|
199
|
-
currentMinute = "0".. currentMinute
|
|
231
|
+
currentMinute = "0" .. currentMinute
|
|
200
232
|
end
|
|
201
233
|
return currentMinute
|
|
202
234
|
end
|
|
203
235
|
|
|
204
|
-
function Time.getRegularHour(currentTime)
|
|
236
|
+
function Time.getRegularHour(currentTime: number): number
|
|
205
237
|
local hour = Time.getHour(currentTime)
|
|
206
238
|
if hour > 12 then
|
|
207
239
|
hour = hour - 12
|
|
@@ -209,23 +241,23 @@ function Time.getRegularHour(currentTime)
|
|
|
209
241
|
return hour
|
|
210
242
|
end
|
|
211
243
|
|
|
212
|
-
function Time.getHourFormatted(currentTime)
|
|
244
|
+
function Time.getHourFormatted(currentTime): string
|
|
213
245
|
local hour = Time.getHour(currentTime)
|
|
214
246
|
if hour < 10 then
|
|
215
|
-
hour = "0"..hour
|
|
247
|
+
hour = "0" .. hour
|
|
216
248
|
end
|
|
217
249
|
return hour
|
|
218
250
|
end
|
|
219
251
|
|
|
220
|
-
function Time.getRegularHourFormatted(currentTime)
|
|
252
|
+
function Time.getRegularHourFormatted(currentTime: number): string
|
|
221
253
|
local hour = Time.getRegularHour(currentTime)
|
|
222
254
|
if hour < 10 then
|
|
223
|
-
hour = "0"..hour
|
|
255
|
+
hour = "0" .. hour
|
|
224
256
|
end
|
|
225
257
|
return hour
|
|
226
258
|
end
|
|
227
259
|
|
|
228
|
-
function Time.getamOrpm(currentTime)
|
|
260
|
+
function Time.getamOrpm(currentTime: number): "am" | "pm"
|
|
229
261
|
local hour = Time.getHour(currentTime)
|
|
230
262
|
|
|
231
263
|
if hour > 12 then
|
|
@@ -235,7 +267,7 @@ function Time.getamOrpm(currentTime)
|
|
|
235
267
|
end
|
|
236
268
|
end
|
|
237
269
|
|
|
238
|
-
function Time.getAMorPM(currentTime)
|
|
270
|
+
function Time.getAMorPM(currentTime: number): "AM" | "PM"
|
|
239
271
|
local hour = Time.getHour(currentTime)
|
|
240
272
|
|
|
241
273
|
if hour > 12 then
|
|
@@ -245,15 +277,15 @@ function Time.getAMorPM(currentTime)
|
|
|
245
277
|
end
|
|
246
278
|
end
|
|
247
279
|
|
|
248
|
-
function Time.getMilitaryHour(currentTime)
|
|
280
|
+
function Time.getMilitaryHour(currentTime: number): string
|
|
249
281
|
local hour = Time.getHour(currentTime)
|
|
250
282
|
if hour < 10 then
|
|
251
|
-
return "0"..hour
|
|
283
|
+
return "0" .. hour
|
|
252
284
|
end
|
|
253
285
|
return hour
|
|
254
286
|
end
|
|
255
287
|
|
|
256
|
-
function Time.isLeapYear(currentTime)
|
|
288
|
+
function Time.isLeapYear(currentTime: number): boolean
|
|
257
289
|
local year = Time.getYear(currentTime)
|
|
258
290
|
if year % 4 == 0 and (year % 100 ~= 0 or year % 400 == 0) then
|
|
259
291
|
return true
|
|
@@ -262,46 +294,46 @@ function Time.isLeapYear(currentTime)
|
|
|
262
294
|
end
|
|
263
295
|
end
|
|
264
296
|
|
|
265
|
-
function Time.getDaysInMonth(currentTime)
|
|
297
|
+
function Time.getDaysInMonth(currentTime: number): number
|
|
266
298
|
local month = Time.getMonth(currentTime)
|
|
267
299
|
local year = Time.getYear(currentTime)
|
|
268
300
|
return Time.getDaysMonthTable(year)[month]
|
|
269
301
|
end
|
|
270
302
|
|
|
271
303
|
local ISO_FORMAT_STRINGS = {
|
|
272
|
-
d = Time.getFormattedDayOfTheMonth
|
|
273
|
-
D = Time.getDayOfTheWeekNameShort
|
|
274
|
-
j = Time.getDayOfTheMonth
|
|
275
|
-
l = Time.getDayOfTheWeekName
|
|
276
|
-
N = Time.getDayOfTheWeek
|
|
277
|
-
S = Time.getDayOfTheMonthOrdinal
|
|
278
|
-
W = Time.getDayOfTheWeek
|
|
279
|
-
Z = Time.getDay
|
|
304
|
+
d = Time.getFormattedDayOfTheMonth,
|
|
305
|
+
D = Time.getDayOfTheWeekNameShort,
|
|
306
|
+
j = Time.getDayOfTheMonth,
|
|
307
|
+
l = Time.getDayOfTheWeekName,
|
|
308
|
+
N = Time.getDayOfTheWeek,
|
|
309
|
+
S = Time.getDayOfTheMonthOrdinal,
|
|
310
|
+
W = Time.getDayOfTheWeek,
|
|
311
|
+
Z = Time.getDay,
|
|
280
312
|
|
|
281
313
|
-- W
|
|
282
314
|
|
|
283
|
-
F = Time.getMonthName
|
|
284
|
-
m = Time.getFormattedMonth
|
|
285
|
-
M = Time.getMonthNameShort
|
|
286
|
-
n = Time.getMonth
|
|
287
|
-
t = Time.getDaysInMonth
|
|
315
|
+
F = Time.getMonthName,
|
|
316
|
+
m = Time.getFormattedMonth,
|
|
317
|
+
M = Time.getMonthNameShort,
|
|
318
|
+
n = Time.getMonth,
|
|
319
|
+
t = Time.getDaysInMonth,
|
|
288
320
|
|
|
289
|
-
L = Time.isLeapYear
|
|
290
|
-
o = Time.getYear
|
|
291
|
-
Y = Time.getYear
|
|
292
|
-
y = Time.getYearShortFormatted
|
|
321
|
+
L = Time.isLeapYear,
|
|
322
|
+
o = Time.getYear,
|
|
323
|
+
Y = Time.getYear, -- Screw ISO-8610, it confuses me.
|
|
324
|
+
y = Time.getYearShortFormatted,
|
|
293
325
|
|
|
294
|
-
a = Time.getamOrpm
|
|
295
|
-
A = Time.getAMorPM
|
|
326
|
+
a = Time.getamOrpm,
|
|
327
|
+
A = Time.getAMorPM,
|
|
296
328
|
--B -- No one uses it
|
|
297
|
-
g = Time.getRegularHour
|
|
298
|
-
G = Time.getHour
|
|
299
|
-
h = Time.getRegularHourFormatted
|
|
300
|
-
H = Time.getHourFormatted
|
|
301
|
-
i = Time.getFormattedMinute
|
|
302
|
-
s = Time.getFormattedSecond
|
|
329
|
+
g = Time.getRegularHour,
|
|
330
|
+
G = Time.getHour,
|
|
331
|
+
h = Time.getRegularHourFormatted,
|
|
332
|
+
H = Time.getHourFormatted,
|
|
333
|
+
i = Time.getFormattedMinute,
|
|
334
|
+
s = Time.getFormattedSecond,
|
|
303
335
|
|
|
304
|
-
X = Time.getJulianDate
|
|
336
|
+
X = Time.getJulianDate, -- For testing purposes.
|
|
305
337
|
|
|
306
338
|
-- e -- No way to get Time Zones
|
|
307
339
|
-- I -- Daylight saving time should be added later.
|
|
@@ -312,31 +344,32 @@ local ISO_FORMAT_STRINGS = {
|
|
|
312
344
|
|
|
313
345
|
-- c -- ISO 8601
|
|
314
346
|
-- r -- No need for formatted dates
|
|
315
|
-
U = time
|
|
347
|
+
U = time,
|
|
316
348
|
}
|
|
317
349
|
|
|
318
|
-
local matchString = "["
|
|
319
|
-
|
|
320
|
-
|
|
350
|
+
local matchString: string = "["
|
|
351
|
+
do
|
|
352
|
+
for i, _ in ISO_FORMAT_STRINGS do
|
|
353
|
+
matchString ..= i
|
|
321
354
|
end
|
|
322
|
-
matchString
|
|
355
|
+
matchString ..= "]"
|
|
323
356
|
end
|
|
324
357
|
|
|
325
|
-
function Time.getFormattedTime(format, currentTime)
|
|
358
|
+
function Time.getFormattedTime(format: string, currentTime: number)
|
|
326
359
|
currentTime = currentTime or tick()
|
|
327
360
|
|
|
328
361
|
local returnString = format
|
|
329
362
|
local formatsRequired = {}
|
|
330
363
|
|
|
331
364
|
for newFormat in string.gmatch(format, matchString) do
|
|
332
|
-
formatsRequired[#formatsRequired+1] = newFormat
|
|
365
|
+
formatsRequired[#formatsRequired + 1] = newFormat
|
|
333
366
|
end
|
|
334
367
|
|
|
335
|
-
for _, formatType in
|
|
368
|
+
for _, formatType in formatsRequired do
|
|
336
369
|
returnString = string.gsub(returnString, formatType, string.rep(formatType, 3))
|
|
337
370
|
end
|
|
338
371
|
|
|
339
|
-
for _, formatType in
|
|
372
|
+
for _, formatType in formatsRequired do
|
|
340
373
|
local replacement = ISO_FORMAT_STRINGS[formatType](currentTime)
|
|
341
374
|
returnString = string.gsub(returnString, string.rep(formatType, 3), replacement)
|
|
342
375
|
end
|
|
@@ -344,4 +377,4 @@ function Time.getFormattedTime(format, currentTime)
|
|
|
344
377
|
return returnString
|
|
345
378
|
end
|
|
346
379
|
|
|
347
|
-
return Time
|
|
380
|
+
return Time
|