numberToDecimal -> formatNumber
This commit is contained in:
parent
914c918eaa
commit
4e383ec107
2 changed files with 3 additions and 3 deletions
|
@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(' ');
|
||||||
|
|
Loading…
Reference in a new issue