-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate.lua
32 lines (27 loc) · 940 Bytes
/
date.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---@meta DateClass
------------------------------------------------------------------------------
-- DateClass
------------------------------------------------------------------------------
if false then -- ensure that functions do not get defined
---@class DateClass
---Converts a number of seconds into a human-readable string. By default, the
---result is returned as a table of three strings. However, if the `as_string`
---parameter is provided, the result is returned as a single string.
---
---@example
---```lua
---date.shms(6543)
-----"01"
-----"49"
-----"03"
---
---date.shms(6453, true)
----- "1h 49m 3s"
---```
---
---@name shms
---@param seconds number - The number of seconds to convert.
---@param as_string boolean? - Whether to return the result as a string.
---@return string[]|string # The resulting string or table of strings.
function date.shms(seconds, as_string) end
end