Closed HamidDarash closed 7 years ago
Becasue class name is jDateTime
, not jDatetime
I have the same issue and my class name is JdateTime also have this error. @morilog can you please help me.?
Again. class name exactly is jDateTime
, not JdateTime
Dear @morilog can you please check the following code what's wrong I changed everything many times installed but have the same error. My composer.json file looks like.
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"intervention/image": "^2.4",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"morilog/jalali": "^3.1",
"spatie/laravel-permission": "^2.37",
"yajra/laravel-datatables-oracle": "~6.0",
"zizaco/entrust": "5.2.x-dev"
},
'providers' => [
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
...
'Morilog\Jalali\JalaliServiceProvider',
],
.
'alias' => [
...
'jDate' => 'Morilog\Jalali\Facades\jDate',
'jDateTime' => 'Morilog\Jalali\Facades\jDateTime',
]
This is my helper function.
function changeDateFormat($date='',$type=0,$report='')
{
$is_persian=false;
if($date && $date !='')
{
$dateArray=explode('/', $date);
if(count($dateArray)<3)
{
return Carbon::now();
}
if($dateArray[0] !=convert($dateArray[0]))
$is_persian=true;
$year=convert($dateArray[0]);
$month=convert($dateArray[1]);
$day=convert($dateArray[2]);
$temp='';
if($is_persian)
{
$temp= \Morilog\Jalali\jDateTime::createCarbonFromFormat(
'Y/m/d',$year.'/'.$month.'/'.$day);
$mydate=Carbon::now();
$mydate->year=$temp->year;
$mydate->month=$temp->month;
$mydate->day=$temp->day;
$temp=$mydate;
}
else
{
//$temp=Carbon::create($year,$month,$day,1);
$mydate=Carbon::now();
$mydate->year=$year;
$mydate->month=$month;
$mydate->day=$day;
$temp=$mydate;
}
if($type)
{
}
if($report !='' && $report)
{
return $temp->format('Y-m-d');
}
else
{
return $temp;
}
//return strtotime($temp->addDay(1));
}
else
{
return $date;
}
}
function convert($string) {
$persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
$arabic = ['٩', '٨', '٧', '٦', '٥', '٤', '٣', '٢', '١','٠'];
$num = range(0, 9);
$convertedPersianNums = str_replace($persian, $num, $string);
$englishNumbersOnly = str_replace($arabic, $num, $convertedPersianNums);
return $englishNumbersOnly;
}
And checked from the controller like this.
$date = Carbon::now();
if ($request->get('date') != '') {
$date= changeDateFormat($request->get('date'));
}
Class 'Morilog\Jalali\jDateTime' not found
There is no any ServiceProvider
, jDate
or jDateTime
facades.
After version 3 this library is framework-agnostic
Please read the version 3 documentations
Hi , i am using your bundle in view or blade , I went through this error "Class 'Morilog\Jalali\jDatetime' not found".
. . .
. . . please help me.