feat: blog section

This commit is contained in:
2026-02-05 14:54:19 +03:30
parent 5e6c788b54
commit 6dc068076d
18 changed files with 1917 additions and 93 deletions
+15
View File
@@ -0,0 +1,15 @@
import { format, newDate } from "date-fns-jalali";
import { faIR } from "date-fns-jalali/locale";
/**
* Format a Gregorian date (Date or ISO string) to Shamsi (Jalali) Persian string.
* Example: "۱۴ بهمن ۱۴۰۴"
*/
export function formatDateShamsi(
date: Date | string,
formatStr: string = "d MMMM yyyy"
): string {
const d = typeof date === "string" ? new Date(date) : date;
if (Number.isNaN(d.getTime())) return "";
return format(d, formatStr, { locale: faIR });
}