mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-22 05:36:15 +01:00
fix container uptime sorting edge case (#1696)
This commit is contained in:
@@ -31,7 +31,8 @@ const unitSeconds = [
|
||||
// Convert docker status string to number of seconds ("Up X minutes", "Up X hours", etc.)
|
||||
function getStatusValue(status: string): number {
|
||||
const [_, num, unit] = status.split(" ")
|
||||
const numValue = Number(num)
|
||||
// Docker uses "a" or "an" instead of "1" for singular units (e.g., "Up a minute", "Up an hour")
|
||||
const numValue = num === "a" || num === "an" ? 1 : Number(num)
|
||||
for (const [unitName, value] of unitSeconds) {
|
||||
if (unit.startsWith(unitName)) {
|
||||
return numValue * value
|
||||
|
||||
Reference in New Issue
Block a user