feat: add format util function for gauge cards

This commit is contained in:
RadoslavDimchev 2023-08-30 10:49:18 +03:00
parent dc122c3730
commit c282436245
1 changed files with 9 additions and 5 deletions

View File

@ -14,11 +14,15 @@
* }
*/
export function assertUnreachable(value: never): never {
throw new Error(`Unreachable case: ${value}`);
throw new Error(`Unreachable case: ${value}`)
}
export const convertSecondsToTimerFormat = (seconds: number) => {
const minutes = Math.floor(seconds / 60)
const remainingSeconds = seconds % 60
return `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}`
}
const minutes = Math.floor(seconds / 60)
const remainingSeconds = seconds % 60
return `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}`
}
export const formatNumberForGauge = (n: number): string => {
return n.toString().replace(/\./g, ',')
}