feat: minute adn logo

This commit is contained in:
2026-06-03 08:54:20 +03:30
parent 821b85d4fe
commit 7b8b8949b9
16 changed files with 58 additions and 24 deletions
+12 -1
View File
@@ -10,10 +10,21 @@ export function toFa(value: string | number | null | undefined): string {
return String(value).replace(/\d/g, (d) => FA_DIGITS[Number(d)]);
}
// Seconds -> "م:ث" style label (e.g. 90 -> ۱:۳۰).
// Seconds -> "م:ث" style label (e.g. 90 -> ۱:۳۰). Used by the timer presets,
// whose backend field is `duration_seconds`.
export function formatDuration(seconds?: number | null): string {
if (!seconds && seconds !== 0) return "—";
const m = Math.floor(seconds / 60);
const s = Math.floor(seconds % 60);
return toFa(`${m}:${String(s).padStart(2, "0")}`);
}
// Minutes -> Persian label. Media and music store `duration` in minutes.
export function formatMinutes(minutes?: number | null): string {
if (minutes === null || minutes === undefined) return "—";
const m = Math.floor(minutes);
if (m < 60) return toFa(`${m} دقیقه`);
const h = Math.floor(m / 60);
const rem = m % 60;
return rem ? toFa(`${h} ساعت و ${rem} دقیقه`) : toFa(`${h} ساعت`);
}