mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-03-02 03:50:40 +00:00
feat: add format util function for gauge cards
This commit is contained in:
parent
dc122c3730
commit
c282436245
@ -14,11 +14,15 @@
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export function assertUnreachable(value: never): never {
|
export function assertUnreachable(value: never): never {
|
||||||
throw new Error(`Unreachable case: ${value}`);
|
throw new Error(`Unreachable case: ${value}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const convertSecondsToTimerFormat = (seconds: number) => {
|
export const convertSecondsToTimerFormat = (seconds: number) => {
|
||||||
const minutes = Math.floor(seconds / 60)
|
const minutes = Math.floor(seconds / 60)
|
||||||
const remainingSeconds = seconds % 60
|
const remainingSeconds = seconds % 60
|
||||||
return `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}`
|
return `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const formatNumberForGauge = (n: number): string => {
|
||||||
|
return n.toString().replace(/\./g, ',')
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user