Hi!
So im trying to change class on an element depending on specific dates.
Im grabbing some json from the database
["2017-06-24","2017-06-25","2017-06-26"]
And as you can see in this example, I have yesterday (24), today (25) and tomorrow (26).
And because I have today in the interval of available dates, I want to append success class. (If it was the 24th today or 26th, I also want the success class)
If these dates has passed, I want to append warning, if they have not passed (future), I don't want to append anything.
I have a partial that I have been struggling with
@foreach(json_decode($event->date) as $date)
@php
$parsed_date = \Carbon\Carbon::createFromFormat('Y-m-d', $date);
@endphp
@if($parsed_date->isSameDay(\Carbon\Carbon::now()))
class="success"
@elseif($parsed_date->isPast())
class="warning"
@endif
@endforeach
But when in between dates, I cannot get it to work properly. How can I achieve this?