Files
baya-monorepo/client/src/services/bookingRequests/format.ts
T
2026-07-19 11:56:59 +03:30

19 lines
828 B
TypeScript

const MINUTES_PER_HOUR = 60;
/**
* Humanized minutes-remaining copy above `CountdownTimer`'s coarse threshold («حدود ۳ ساعت» / «حدود ۲۵
* دقیقه»). Shared by the customer C5 response countdown and the nurse inbox's urgency-tinted countdown
* pill (ui-phase-7) — both count down the same `nurseResponseDeadlineAt`, so the humanized framing must
* read identically in both places. `t` is the `booking` namespace translator (`countdown_about_hours`/
* `countdown_about_minutes`).
*/
export function coarseResponseLabel(
minutes: number,
t: (key: string, values?: Record<string, number>) => string,
): string {
if (minutes >= MINUTES_PER_HOUR) {
return t('countdown_about_hours', { hours: Math.round(minutes / MINUTES_PER_HOUR) });
}
return t('countdown_about_minutes', { minutes });
}