1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix slider rounding

This commit is contained in:
Dmitry Lyzo 2023-09-25 23:37:45 +03:00
parent 2946ed4e35
commit 9e8c7d788a
2 changed files with 25 additions and 1 deletions

View file

@ -32,3 +32,16 @@ export function toPercent(value: number | null | undefined, locale: string): str
return `${Math.round(value * 100)}%`;
}
/**
* Gets decimal count of a Number.
* @param {number} value Number.
* @returns {number} Decimal count of a Number.
*/
export function decimalCount(value: number): number {
if (Number.isInteger(value)) return 0;
const arr = value.toString().split('.');
return arr[1].length;
}