mercredi 23 novembre 2016

Check if current date lies between start date and end date (Laravel 5.3)

So, I have this view in my controller to show a button if the current date lies between the start date and the end date. Here is what I have done so far :

@if (Carbon\Carbon::now()->format('Y-m-d') < Carbon\Carbon::parse($edition->start)->format('Y-m-d') && Carbon\Carbon::now()->format('Y-m-d') > Carbon\Carbon::parse($edition->end)->format('Y-m-d'))
     <p></p>
@else
     <div class="tombol-nav">
       <a href="../journal/create?edition=" class="btn btn-primary">Upload Jurnal Anda Sekarang!</a><br>
       <p style="color: red;">Penting! Batas waktu terakhir pengunggahan Jurnal pada Edisi ini : </p>
     </div>
@endif

I don't know what's wrong with it, the button will still appear even though the end date has passed. Thank you for your help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire