aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-07-01 16:41:18 -0500
committermat <github@matdoes.dev>2022-07-01 17:14:13 -0500
commit8a0015a03cc48e6fd75cdc8d355b5064f422b53a (patch)
treef264594ea52cbcc5806a50513bb05c0adec39616 /src
parent0a1449c7ee3b53175b8a7a8886400d4da9c7364d (diff)
downloadskyblock-stats-8a0015a03cc48e6fd75cdc8d355b5064f422b53a.tar.gz
skyblock-stats-8a0015a03cc48e6fd75cdc8d355b5064f422b53a.tar.bz2
skyblock-stats-8a0015a03cc48e6fd75cdc8d355b5064f422b53a.zip
Add commas to millisecondsToTime
Diffstat (limited to 'src')
-rw-r--r--src/lib/utils.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index c094db4..be8c0fb 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -129,11 +129,11 @@ export function millisecondsToTime(totalMilliseconds: number, opts: Milliseconds
const smallestUnit = opts.smallestUnit ?? 0
- if (totalDays > 1 && smallestUnit <= 4) stringUnits.push(days === 1 ? `${days} day` : `${days} days`)
- if (totalHours > 1 && smallestUnit <= 3) stringUnits.push(hours === 1 ? `${hours} hour` : `${hours} hours`)
- if (totalMinutes > 1 && smallestUnit <= 2) stringUnits.push(minutes === 1 ? `${minutes} minute` : `${minutes} minutes`)
- if (totalSeconds > 1 && smallestUnit <= 1) stringUnits.push(seconds === 1 ? `${seconds} second` : `${seconds} seconds`)
- if (totalMilliseconds > 0 && smallestUnit <= 0) stringUnits.push(`${milliseconds} ms`)
+ if (totalDays > 1 && smallestUnit <= 4) stringUnits.push(days === 1 ? `${days.toLocaleString()} day` : `${days.toLocaleString()} days`)
+ if (totalHours > 1 && smallestUnit <= 3) stringUnits.push(hours === 1 ? `${hours.toLocaleString()} hour` : `${hours.toLocaleString()} hours`)
+ if (totalMinutes > 1 && smallestUnit <= 2) stringUnits.push(minutes === 1 ? `${minutes.toLocaleString()} minute` : `${minutes.toLocaleString()} minutes`)
+ if (totalSeconds > 1 && smallestUnit <= 1) stringUnits.push(seconds === 1 ? `${seconds.toLocaleString()} second` : `${seconds.toLocaleString()} seconds`)
+ if (totalMilliseconds > 0 && smallestUnit <= 0) stringUnits.push(`${milliseconds.toLocaleString()} ms`)
// comma separated, "and" before last