I have a expiration date for my file in database.
I want to convert it to julian persian date and compact it to the edit page.
This is my Controller:
Public function edit(Panelfile $panelfile)
{
$expiration = Jalalian::fromCarbon($panelfile->expiration)->format('Y-m-d');
$date = CalendarUtils::toJalali($expiration);
return view('file.edit',compact('panelfile','date'));
}
this is my datepicker input:
<div class="form-group">
<input type="text" name"expiration" value="{{$date}}" data-jdp>
</div>
I get this error when I go to the edit page:
Agrument 1 passed to Morilog\Jalali\Jalalian::fromCarbon() must be an intance of Carbon\Carbon, string given
How can i solve this?
Change this line:
to this:
Now you have something like
1400-06-02in$expiration(it's Jalali date).If you take a look at
toJalalimethod, it takes 3 argument:You already have the Jalali date and (I think) you don't need to use the line after that. But if you want to use
toJalalimethod, you should pass three arguments to it: