Normalizes uptime values which may be provided in different formats
(with or without % symbol, as string or number). Ensures consistent
percentage display format.
Parameters
uptime: string
Uptime value in various formats
Returns string
Formatted uptime string with % symbol
Example
formatUptime("99.9%") // "99.9%" (already formatted) formatUptime("99.9") // "99.9%" (adds % symbol) formatUptime("0.999") // "99.9%" (converts decimal to percentage) formatUptime("invalid") // "invalid" (returns as-is if not parseable)
Format uptime percentage for availability display
Normalizes uptime values which may be provided in different formats (with or without % symbol, as string or number). Ensures consistent percentage display format.