numberToDecimal -> formatNumber

This commit is contained in:
0x1eef 2023-03-10 18:53:38 -03:00
parent 914c918eaa
commit 4e383ec107
2 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import * as Quran from 'lib/Quran'; import * as Quran from 'lib/Quran';
import { numberToDecimal } from 'lib/i18n'; import { formatNumber } from 'lib/i18n';
interface Props { interface Props {
surah: Quran.Surah surah: Quran.Surah
@ -25,7 +25,7 @@ export function Timer ({ surah, stream, setStream, locale, isPaused }: Props) {
}, [ms, isPaused]); }, [ms, isPaused]);
return ( return (
<div className='timer'> <div className='timer'>
{numberToDecimal(ms / 1000, locale)} {formatNumber(ms / 1000, locale)}
</div> </div>
); );
} }

View file

@ -33,7 +33,7 @@ export function i18n(json: string): TFunction {
}; };
} }
export function numberToDecimal(number: number, locale: Quran.Locale): string { export function formatNumber(number: number, locale: Quran.Locale): string {
return number.toLocaleString(locale, { maximumFractionDigits: 1 }) return number.toLocaleString(locale, { maximumFractionDigits: 1 })
.split(/([^\d])/) .split(/([^\d])/)
.join(' '); .join(' ');