diff --git a/src/js/components/SurahStream/Timer.tsx b/src/js/components/SurahStream/Timer.tsx index 7d6a72f..81b286a 100644 --- a/src/js/components/SurahStream/Timer.tsx +++ b/src/js/components/SurahStream/Timer.tsx @@ -39,7 +39,7 @@ export function Timer({ locale, surah, ayah, isPaused, audioStatus, onComplete } } else if (ms <= 0) { onComplete(surah, ayah); } else { - const tid = setTimeout(() => setMs(ms - 100), 100); + const tid = setTimeout(() => setMs(ms - 1000), 1000); return () => clearTimeout(tid); } }, [isStalled, isPaused, ms]); @@ -50,7 +50,9 @@ export function Timer({ locale, surah, ayah, isPaused, audioStatus, onComplete } return (
- {!ms || ms / 1000 <= 0 ? formatNumber(locale, 0) : formatNumber(locale, ms / 1000)} + {!ms || ms / 1000 <= 0 + ? formatNumber(locale, 0) + : formatNumber(locale, ms / 1000, { maximumFractionDigits: 0 })}
); } diff --git a/src/js/lib/t.ts b/src/js/lib/t.ts index e47cf3a..f65af52 100644 --- a/src/js/lib/t.ts +++ b/src/js/lib/t.ts @@ -17,8 +17,9 @@ export function T(phrases: PhraseMap): TFunction { }; } -export function formatNumber(locale: TLocale, num: number): string { +export function formatNumber(locale: TLocale, num: number, options = {}): string { const numl = locale.name === "ar" ? "ar-SA" : locale.name; - const options = { maximumFractionDigits: 1 }; - return new Intl.NumberFormat(numl, options).format(num); + return new Intl.NumberFormat(numl, { maximumFractionDigits: 1, ...options }).format( + num, + ); }