admin/features/events/eventCardLabels.ts
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

26 lines
1.0 KiB
TypeScript

/**
* eventCardLabels — shared date / time / price strings for consumer event cards.
*
* Purpose
* - One formatting path for discovery, host, booking, profile, and public cards.
* - Keep Persian weekday/long date and HH:mm range consistent across adapters.
*/
import { formatCurrency } from '@/helpers'
import { formatPersianDate } from '@/lib/formatters'
import { format, texts } from '@/texts'
export const formatEventCardDateLabel = (startsAt: string) =>
formatPersianDate(startsAt, { weekday: 'long', day: 'numeric', month: 'long' })
export const formatEventCardClockLabel = (value: string) => formatPersianDate(value, { hour: '2-digit', minute: '2-digit' })
export const formatEventCardTimeRange = (startsAt: string, endsAt: string) =>
format(texts.events.timeRange, {
start: formatEventCardClockLabel(startsAt),
end: formatEventCardClockLabel(endsAt),
})
export const formatEventCardPriceLabel = (input: { isFree: boolean; price: number | string }) =>
input.isFree ? texts.events.free : formatCurrency(Number(input.price), false)