@quenty/time 2.4.6 → 2.5.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 +16 -71
- package/package.json +2 -2
- package/src/Shared/Time.lua +29 -29
package/CHANGELOG.md
CHANGED
|
@@ -3,139 +3,84 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
6
|
+
# [2.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.4.6...@quenty/time@2.5.0) (2026-07-14)
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
### Features
|
|
12
9
|
|
|
10
|
+
- **time:** convert package to --!strict ([f5e3586](https://github.com/Quenty/NevermoreEngine/commit/f5e3586e6a1ca22139e1717d1b32741552d9126b))
|
|
13
11
|
|
|
12
|
+
## [2.4.6](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.4.5...@quenty/time@2.4.6) (2026-01-12)
|
|
14
13
|
|
|
14
|
+
### Bug Fixes
|
|
15
15
|
|
|
16
|
+
- Fix dependency installation process for pnpm ([9651b09](https://github.com/Quenty/NevermoreEngine/commit/9651b09af34f252ef3f9c7c539793cc878dd8cba))
|
|
16
17
|
|
|
17
18
|
## [2.4.5](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.4.4...@quenty/time@2.4.5) (2026-01-10)
|
|
18
19
|
|
|
19
20
|
**Note:** Version bump only for package @quenty/time
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
22
|
## [2.4.4](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.4.3...@quenty/time@2.4.4) (2026-01-03)
|
|
26
23
|
|
|
27
24
|
**Note:** Version bump only for package @quenty/time
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
26
|
## [2.4.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.4.2...@quenty/time@2.4.3) (2025-05-10)
|
|
34
27
|
|
|
35
28
|
**Note:** Version bump only for package @quenty/time
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
30
|
## [2.4.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.4.0...@quenty/time@2.4.2) (2025-04-07)
|
|
42
31
|
|
|
43
|
-
|
|
44
32
|
### Bug Fixes
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
- Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
35
|
+
- Bump package versions for republishing ([ba47c62](https://github.com/Quenty/NevermoreEngine/commit/ba47c62e32170bf74377b0c658c60b84306dc294))
|
|
52
36
|
|
|
53
37
|
## [2.4.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.4.0...@quenty/time@2.4.1) (2025-04-07)
|
|
54
38
|
|
|
55
|
-
|
|
56
39
|
### Bug Fixes
|
|
57
40
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
41
|
+
- Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
63
42
|
|
|
64
43
|
# [2.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.3.0...@quenty/time@2.4.0) (2024-09-25)
|
|
65
44
|
|
|
66
|
-
|
|
67
45
|
### Bug Fixes
|
|
68
46
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
47
|
+
- Rename `:gsub()` to `string.gsub` ([9a730cb](https://github.com/Quenty/NevermoreEngine/commit/9a730cbd7001706787c5e5db0efe2306b2234b3a))
|
|
48
|
+
- Rename `:rep()` to `string.repeat` ([476b7c9](https://github.com/Quenty/NevermoreEngine/commit/476b7c94be8e1a68e8e281ccb9c8445c2b549812))
|
|
75
49
|
|
|
76
50
|
# [2.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.2.0...@quenty/time@2.3.0) (2024-05-09)
|
|
77
51
|
|
|
78
|
-
|
|
79
52
|
### Bug Fixes
|
|
80
53
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
54
|
+
- Fix .package-lock.json replicating in packages ([75d0efe](https://github.com/Quenty/NevermoreEngine/commit/75d0efeef239f221d93352af71a5b3e930ec23c5))
|
|
86
55
|
|
|
87
56
|
# [2.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.1.0...@quenty/time@2.2.0) (2023-08-23)
|
|
88
57
|
|
|
89
58
|
**Note:** Version bump only for package @quenty/time
|
|
90
59
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
60
|
# [2.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.0.1...@quenty/time@2.1.0) (2022-03-27)
|
|
96
61
|
|
|
97
62
|
**Note:** Version bump only for package @quenty/time
|
|
98
63
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
64
|
## [2.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@2.0.0...@quenty/time@2.0.1) (2021-12-30)
|
|
104
65
|
|
|
105
66
|
**Note:** Version bump only for package @quenty/time
|
|
106
67
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
68
|
# [2.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/time@1.2.0...@quenty/time@2.0.0) (2021-09-05)
|
|
112
69
|
|
|
113
|
-
|
|
114
70
|
### Bug Fixes
|
|
115
71
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
72
|
+
- Remove peer dependencies. This is because lerna doesn't really support peer dependencies being linked and getting a new version on build, which is unfortunate. ([5f5aeee](https://github.com/Quenty/NevermoreEngine/commit/5f5aeeea8de9975435309e53679f0ef7064f9dd0))
|
|
121
73
|
|
|
122
74
|
# 1.2.0 (2021-07-31)
|
|
123
75
|
|
|
124
|
-
|
|
125
76
|
### Bug Fixes
|
|
126
77
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
78
|
+
- Add CI and CD ([47513e9](https://github.com/Quenty/NevermoreEngine/commit/47513e9b568162707534af132396dd8756947dd3))
|
|
79
|
+
- Adjust CI badge to show automatic build and release state ([5a55d3f](https://github.com/Quenty/NevermoreEngine/commit/5a55d3f19bf8d66a760d67da9b56ed47fab74656))
|
|
80
|
+
- Fix selene linting ([45fc074](https://github.com/Quenty/NevermoreEngine/commit/45fc07489ee59127ac6582689f19a0e87c1e5b5a))
|
|
132
81
|
|
|
133
82
|
## 1.0.2 (2021-07-25)
|
|
134
83
|
|
|
135
|
-
|
|
136
|
-
|
|
137
84
|
## 1.0.1 (2021-07-25)
|
|
138
85
|
|
|
139
|
-
|
|
140
|
-
|
|
141
86
|
# 1.0.0 (2021-07-24)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/time",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "13f0162f4971a77378e55e9b7236aea94f0dd3a8"
|
|
34
34
|
}
|
package/src/Shared/Time.lua
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Library handles time based parsing / operations. Untested. Based off of PHP's time system.
|
|
4
4
|
|
|
@@ -111,9 +111,9 @@ end
|
|
|
111
111
|
function Time.getYearShortFormatted(currentTime: number): string
|
|
112
112
|
local shortYear = Time.getYearShort(currentTime)
|
|
113
113
|
if shortYear < 10 then
|
|
114
|
-
|
|
114
|
+
return "0" .. shortYear
|
|
115
115
|
end
|
|
116
|
-
return shortYear
|
|
116
|
+
return tostring(shortYear)
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
--[=[
|
|
@@ -144,12 +144,12 @@ end
|
|
|
144
144
|
@return string
|
|
145
145
|
]=]
|
|
146
146
|
function Time.getFormattedMonth(currentTime: number): string
|
|
147
|
-
local month = Time.getMonth(currentTime)
|
|
147
|
+
local month = assert(Time.getMonth(currentTime), "Failed to get month")
|
|
148
148
|
if month < 10 then
|
|
149
|
-
|
|
149
|
+
return "0" .. month
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
-
return month
|
|
152
|
+
return tostring(month)
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
--[=[
|
|
@@ -180,13 +180,13 @@ end
|
|
|
180
180
|
@return string
|
|
181
181
|
]=]
|
|
182
182
|
function Time.getFormattedDayOfTheMonth(currentTime: number): string
|
|
183
|
-
local dayOfTheMonth = Time.getDayOfTheMonth(currentTime)
|
|
183
|
+
local dayOfTheMonth = assert(Time.getDayOfTheMonth(currentTime), "Failed to get day of the month")
|
|
184
184
|
|
|
185
185
|
if dayOfTheMonth < 10 then
|
|
186
|
-
|
|
186
|
+
return "0" .. dayOfTheMonth
|
|
187
187
|
end
|
|
188
188
|
|
|
189
|
-
return dayOfTheMonth
|
|
189
|
+
return tostring(dayOfTheMonth)
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
--[=[
|
|
@@ -222,8 +222,8 @@ end
|
|
|
222
222
|
@param currentTime number
|
|
223
223
|
@return number
|
|
224
224
|
]=]
|
|
225
|
-
function Time.getJulianDate(currentTime: number)
|
|
226
|
-
local month = Time.getMonth(currentTime)
|
|
225
|
+
function Time.getJulianDate(currentTime: number): number
|
|
226
|
+
local month = assert(Time.getMonth(currentTime), "Failed to get month")
|
|
227
227
|
local year = Time.getYear(currentTime)
|
|
228
228
|
local day = Time.getDay(currentTime)
|
|
229
229
|
|
|
@@ -317,9 +317,9 @@ end
|
|
|
317
317
|
function Time.getFormattedSecond(currentTime: number): string
|
|
318
318
|
local currentSecond = Time.getSecond(currentTime)
|
|
319
319
|
if currentSecond < 10 then
|
|
320
|
-
|
|
320
|
+
return "0" .. currentSecond
|
|
321
321
|
end
|
|
322
|
-
return currentSecond
|
|
322
|
+
return tostring(currentSecond)
|
|
323
323
|
end
|
|
324
324
|
|
|
325
325
|
--[=[
|
|
@@ -330,9 +330,9 @@ end
|
|
|
330
330
|
function Time.getFormattedMinute(currentTime: number): string
|
|
331
331
|
local currentMinute = Time.getMinute(currentTime)
|
|
332
332
|
if currentMinute < 10 then
|
|
333
|
-
|
|
333
|
+
return "0" .. currentMinute
|
|
334
334
|
end
|
|
335
|
-
return currentMinute
|
|
335
|
+
return tostring(currentMinute)
|
|
336
336
|
end
|
|
337
337
|
|
|
338
338
|
--[=[
|
|
@@ -353,12 +353,12 @@ end
|
|
|
353
353
|
@param currentTime number
|
|
354
354
|
@return string
|
|
355
355
|
]=]
|
|
356
|
-
function Time.getHourFormatted(currentTime): string
|
|
356
|
+
function Time.getHourFormatted(currentTime: number): string
|
|
357
357
|
local hour = Time.getHour(currentTime)
|
|
358
358
|
if hour < 10 then
|
|
359
|
-
|
|
359
|
+
return "0" .. hour
|
|
360
360
|
end
|
|
361
|
-
return hour
|
|
361
|
+
return tostring(hour)
|
|
362
362
|
end
|
|
363
363
|
|
|
364
364
|
--[=[
|
|
@@ -369,9 +369,9 @@ end
|
|
|
369
369
|
function Time.getRegularHourFormatted(currentTime: number): string
|
|
370
370
|
local hour = Time.getRegularHour(currentTime)
|
|
371
371
|
if hour < 10 then
|
|
372
|
-
|
|
372
|
+
return "0" .. hour
|
|
373
373
|
end
|
|
374
|
-
return hour
|
|
374
|
+
return tostring(hour)
|
|
375
375
|
end
|
|
376
376
|
|
|
377
377
|
--[=[
|
|
@@ -414,7 +414,7 @@ function Time.getMilitaryHour(currentTime: number): string
|
|
|
414
414
|
if hour < 10 then
|
|
415
415
|
return "0" .. hour
|
|
416
416
|
end
|
|
417
|
-
return hour
|
|
417
|
+
return tostring(hour)
|
|
418
418
|
end
|
|
419
419
|
|
|
420
420
|
--[=[
|
|
@@ -437,12 +437,12 @@ end
|
|
|
437
437
|
@return number
|
|
438
438
|
]=]
|
|
439
439
|
function Time.getDaysInMonth(currentTime: number): number
|
|
440
|
-
local month = Time.getMonth(currentTime)
|
|
440
|
+
local month = assert(Time.getMonth(currentTime), "Failed to get month")
|
|
441
441
|
local year = Time.getYear(currentTime)
|
|
442
442
|
return Time.getDaysMonthTable(year)[month]
|
|
443
443
|
end
|
|
444
444
|
|
|
445
|
-
local ISO_FORMAT_STRINGS = {
|
|
445
|
+
local ISO_FORMAT_STRINGS: { [string]: (number) -> any } = {
|
|
446
446
|
d = Time.getFormattedDayOfTheMonth,
|
|
447
447
|
D = Time.getDayOfTheWeekNameShort,
|
|
448
448
|
j = Time.getDayOfTheMonth,
|
|
@@ -500,14 +500,14 @@ end
|
|
|
500
500
|
--[=[
|
|
501
501
|
Formats the given time based on the provided format string.
|
|
502
502
|
@param format string
|
|
503
|
-
@param currentTime number
|
|
503
|
+
@param currentTime number?
|
|
504
504
|
@return string
|
|
505
505
|
]=]
|
|
506
|
-
function Time.getFormattedTime(format: string, currentTime: number)
|
|
507
|
-
|
|
506
|
+
function Time.getFormattedTime(format: string, currentTime: number?): string
|
|
507
|
+
local resolvedTime = currentTime or tick()
|
|
508
508
|
|
|
509
509
|
local returnString = format
|
|
510
|
-
local formatsRequired = {}
|
|
510
|
+
local formatsRequired: { string } = {}
|
|
511
511
|
|
|
512
512
|
for newFormat in string.gmatch(format, matchString) do
|
|
513
513
|
formatsRequired[#formatsRequired + 1] = newFormat
|
|
@@ -518,8 +518,8 @@ function Time.getFormattedTime(format: string, currentTime: number)
|
|
|
518
518
|
end
|
|
519
519
|
|
|
520
520
|
for _, formatType in formatsRequired do
|
|
521
|
-
local replacement = ISO_FORMAT_STRINGS[formatType](
|
|
522
|
-
returnString = string.gsub(returnString, string.rep(formatType, 3), replacement)
|
|
521
|
+
local replacement = ISO_FORMAT_STRINGS[formatType](resolvedTime)
|
|
522
|
+
returnString = string.gsub(returnString, string.rep(formatType, 3), tostring(replacement))
|
|
523
523
|
end
|
|
524
524
|
|
|
525
525
|
return returnString
|