This commit is contained in:
hamid zarghami
2025-08-21 12:37:02 +03:30
parent ae0deb7cbe
commit fffe4112c6
9 changed files with 311 additions and 2 deletions
+27
View File
@@ -0,0 +1,27 @@
export const formatDate = (dateString: string): string => {
try {
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);
} catch (error) {
return dateString;
}
};
export const formatDateShort = (dateString: string): string => {
try {
const date = new Date(dateString);
return new Intl.DateTimeFormat("fa-IR", {
year: "numeric",
month: "short",
day: "numeric",
}).format(date);
} catch (error) {
return dateString;
}
};