I would like to compare 2 dates. So I create a condition like this in my template blade:
@if(\Carbon\Carbon::parse($contrat->date_facturation)->format('d/m/Y') < $dateNow)
<td class="danger">
{{ \Carbon\Carbon::parse($contrat->date_facturation)->format('d/m/Y') }}
</td>
@else
<td>
{{ \Carbon\Carbon::parse($contrat->date_facturation)->format('d/m/Y') }}
</td>
@endif
Run Code Online (Sandbox Code Playgroud)
My variable $dateNow has the same format on my value in $contract->date_facturation
It add a red background on the date 25/02/2018 while the date is not less than the variable $contract->date_facturation
Do you have any idea of ??the problem?
Thank you