Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
26 lines
1.0 KiB
TypeScript
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)
|