Wire homepage specials, product/blog pages, instant search, and the customer portal so the live pharmacy site can be managed from the dashboard. Co-authored-by: Cursor <cursoragent@cursor.com>
15 lines
444 B
TypeScript
15 lines
444 B
TypeScript
export function faDigits(value: string | number) {
|
|
return String(value).replace(/\d/g, (digit) => "۰۱۲۳۴۵۶۷۸۹"[Number(digit)]);
|
|
}
|
|
|
|
export function formatPrice(value: number) {
|
|
return faDigits(value.toLocaleString("en-US"));
|
|
}
|
|
|
|
export function formatFaDate(value?: string | null) {
|
|
if (!value) return "";
|
|
const date = new Date(value);
|
|
if (Number.isNaN(date.getTime())) return "";
|
|
return date.toLocaleDateString("fa-IR");
|
|
}
|