Fix percentage helper

This commit is contained in:
Ken Hibino 2021-01-29 16:01:30 -08:00
parent 0626daab0b
commit 747ff21218

View File

@ -90,6 +90,7 @@ export function uuidPrefix(uuid: string): string {
} }
export function percentage(numerator: number, denominator: number): string { export function percentage(numerator: number, denominator: number): string {
if (denominator === 0) return "0.00%";
const perc = ((numerator / denominator) * 100).toFixed(2); const perc = ((numerator / denominator) * 100).toFixed(2);
return `${perc} %`; return `${perc} %`;
} }