28 lines
701 B
TypeScript
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);
|
|
};
|