feat(payment): add Jalali date formatting for appointment confirmation SMS

This commit is contained in:
hamed
2026-06-25 16:34:54 +03:30
parent b1a43b7740
commit 71edc772c8
3 changed files with 18 additions and 2 deletions
@@ -43,6 +43,21 @@ class JalaliDateService
return [$jy, $jm, $jd];
}
/** تبدیل timestamp به رشته‌ی شمسی: «۱۴۰۵/۰۴/۰۲ ۰۹:۰۰» (پیش‌فرض با ساعت). */
public function formatDateTime(int $timestamp, bool $withTime = true): string
{
$pattern = $withTime ? 'yyyy/MM/dd HH:mm' : 'yyyy/MM/dd';
$f = new \IntlDateFormatter(
'fa_IR@calendar=persian',
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
'Asia/Tehran',
\IntlDateFormatter::TRADITIONAL,
$pattern,
);
return $f->format($timestamp);
}
public function jalaliYear(int $timestamp): int
{
return $this->gregorianToJalali(