Utility library to convert to/from milliseconds. Based on vercel/ms.
Add an entry to your wally.toml
file and run wally install
.
[dependencies]
ms = "csqrl/ms@x.x.x" # Replace x.x.x with the latest version
Pre-built binaries are available on the releases page. Download the latest rbxm
file and drop it into Studio.
Commas added for legibility. Actual output is an integer.
ms("2 days") -- 172,800,000
ms("1d") -- 86,400,000
ms("10h") -- 36,000,000
ms("2.5 hrs") -- 9,000,000
ms("2h") -- 7,200,000
ms("1m") -- 60,000
ms("5s") -- 5,000
ms("1y") -- 31,556,995,200
ms("100") -- 100
ms("-3 days") -- -259,200,000
ms("-1h") -- -3,600,000
ms("-200") -- -200
ms("1d, 10h") -- 122,400,000
ms("2 days, 1m") -- 172,860,000
ms("-3days+1d") -- -172,860,000
ms("1y,6mo 5wks-2d 32m 1240ms") -- 49,962,116,440
ms("6 years") -- 189,345,600,000
ms("1 hour", "s") -- 3,600
ms("1d", "s") -- 86,400
ms(60000) -- "1m"
ms(2 * 60000) -- "2m"
ms(-3 * 60000) -- "-3m"
ms(ms("10 hours")) -- "10h"
ms(60000, "long") -- "1 minute"
ms(2 * 60000, "long") -- "2 minutes"
ms(-3 * 60000, "long") -- "-3 minutes"
ms(ms("10 hours"), "long") -- "10 hours"
ms(60000, "short") -- "1m"
ms(60000, "long", "s") -- "17 hours"
ms(60, nil, "s") -- "1 minute"
ms(1, "long", "h") -- "1 hour"