@php $currentDay = \Carbon\Carbon::parse(now(company()->timezone)->toDateTimeString()) ->startOfDay() ->setTimezone('UTC'); @endphp
@if (in_array('admin', user_roles())) @foreach ($noticePeriod as $noticePeriod) @php $noticePeriodEndDate = Carbon\carbon::parse($noticePeriod->notice_period_end_date); $noticePeriodStartDate = Carbon\carbon::parse($noticePeriod->notice_period_start_date); $diffInDays = $noticePeriodEndDate->copy()->diffForHumans($currentDay); @endphp @if ($noticePeriodEndDate->setTimezone(company()->timezone)->isToday()) @lang('app.today') @elseif ($diffInDays == '1 week after') {{ $diffInDays }} @else {{ $diffInDays }} @endif
@if ($noticePeriodEndDate->setTimezone(company()->timezone)->isToday()) {{ $noticePeriodStartDate->format($company->date_format) . ' - ' . $noticePeriodEndDate->format($company->date_format) }} @elseif ($diffInDays == '1 week after') {{ $noticePeriodStartDate->format($company->date_format) . ' - ' . $noticePeriodEndDate->format($company->date_format) }} @else {{ $noticePeriodStartDate->format($company->date_format) . ' - ' . $noticePeriodEndDate->format($company->date_format) }} @endif @endforeach @else @php $noticePeriodStartDate = Carbon\carbon::parse($noticePeriod->notice_period_start_date); $noticePeriodEndDate = Carbon\carbon::parse($noticePeriod->notice_period_end_date); $diffInDays = $noticePeriodEndDate->copy()->diffForHumans($currentDay); @endphp @if ($noticePeriodEndDate->setTimezone(company()->timezone)->isToday()) {{ $noticePeriodStartDate->format($company->date_format) . ' - ' . $noticePeriodEndDate->format($company->date_format) }} @elseif ($diffInDays == '1 week after') {{ $noticePeriodStartDate->format($company->date_format) . ' - ' . $noticePeriodEndDate->format($company->date_format) }} @else {{ $noticePeriodStartDate->format($company->date_format) . ' - ' . $noticePeriodEndDate->format($company->date_format) }} @endif @if ($noticePeriodEndDate->setTimezone(company()->timezone)->isToday()) @lang('app.today') @elseif ($diffInDays == '1 week after') {{ $diffInDays }} @else {{ $diffInDays }} @endif @endif