Files
dpage-editor/src/helpers/func.ts
T
hamid zarghami d36b8e40f0 base structure
2025-11-12 11:45:13 +03:30

28 lines
701 B
TypeScript

export const formatDate = (dateString: string): string => {
const date = new Date(dateString);
return new Intl.DateTimeFormat("fa-IR", {
year: "numeric",
month: "long",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
}).format(date);
};
export const formatDateShort = (dateString: string): string => {
const date = new Date(dateString);
return new Intl.DateTimeFormat("fa-IR", {
year: "numeric",
month: "short",
day: "numeric",
}).format(date);
};
export const formatPrice = (price: number): string => {
return new Intl.NumberFormat("fa-IR", {
style: "decimal",
minimumFractionDigits: 0,
maximumFractionDigits: 0,
}).format(price);
};