edit delay error
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ if (isset($_COOKIE['token01'])) {
|
||||
//dd($user);
|
||||
if (!empty($user->attendances)) {
|
||||
foreach ($user->attendances as $att) {
|
||||
$date = $att->entered_at != null ? Jalalian::fromCarbon(Carbon::parse($att->entered_at)) : null;
|
||||
$date = $att->entered_at != null ? \App\Support\JalaliHelper::fromDateTime($att->entered_at) : null;
|
||||
$att->date = $date != null ? $date->format('Y/m/d') : null;
|
||||
if ($att->duration != null && $date != null && $now->getMonth() == $date->getMonth()) {
|
||||
[$h, $m, $sec] = explode(':', $att->duration);
|
||||
@@ -414,7 +414,7 @@ SVG;
|
||||
|
||||
<td class="py-4 px-6 text-sm text-gray-900 whitespace-nowrap text-right"
|
||||
style="background-color: {{$item->requested ? '' :($item->distance < 10 ? '#d1fae5' : ($item->distance < 50 ? '#dbeafe' : ($item->distance > 2000 ? '#ffedd5' : '#f3f4f6'))) }}; color: #111827;">
|
||||
{{ $item->entered_at ? Jalalian::fromCarbon(Carbon::parse($item->entered_at))->format('m/d') : '-' }}
|
||||
{{ \App\Support\JalaliHelper::format($item->entered_at, 'm/d') }}
|
||||
</td>
|
||||
|
||||
<td class="py-4 px-6 text-sm text-gray-900 whitespace-nowrap text-right"
|
||||
|
||||
@@ -241,7 +241,7 @@ if (!empty($user->tasks)) {
|
||||
|
||||
{{-- مدت زمان --}}
|
||||
<td style="border-right: 1px solid #ddd; padding: 4px;">
|
||||
{{ $item->entered_at && $item->exited_at ? \Carbon\Carbon::parse($item->duration)->format('H:i') : '-' }}
|
||||
{{ $item->entered_at && $item->exited_at && $item->duration ? \Illuminate\Support\Str::of($item->duration)->beforeLast(':')->toString() : '-' }}
|
||||
</td>
|
||||
|
||||
{{-- تأخیر --}}
|
||||
|
||||
Reference in New Issue
Block a user