edit delay error

This commit is contained in:
2026-07-22 17:48:22 +03:30
parent e9f397d759
commit dc276dfbb5
3 changed files with 13 additions and 6 deletions
+10 -3
View File
@@ -15,12 +15,19 @@ class JalaliHelper
}
try {
$carbon = $value instanceof Carbon ? $value : Carbon::parse($value);
if ($carbon->year < 1000 || $carbon->year > 3000) {
$carbon = $value instanceof Carbon ? $value->copy() : Carbon::parse($value);
// سال میلادی نامعتبر / خیلی قدیمی → تبدیل شمسی ممکن است year=0 بدهد
if ($carbon->year < 1621 || $carbon->year > 2500) {
return null;
}
return Jalalian::fromCarbon($carbon);
$jalali = Jalalian::fromCarbon($carbon);
if ($jalali->getYear() < 1000 || $jalali->getYear() > 3000) {
return null;
}
return $jalali;
} catch (Throwable $e) {
return null;
}