Closed alihastam closed 5 years ago
extension for jalali date PersianDate.php `<?php
namespace App\Admin\Extensions;
use Encore\Admin\Form\Field;
class PersianDate extends Field { protected $view = 'admin.pdate';
protected $prepend;
protected static $css = [
'/css/persian-datepicker.css',
];
protected static $js = [
'/js/persian-date.min.js',
'/js/persian-datepicker.min.js',
];
public function render()
{
$this->script = "$('{$this->getElementClassSelector()}').persianDatepicker({
format: 'L',
altFormat: 'llll',
initialValue: false,
'timePicker.enabled': true,
initialValueType: 'persian'
});";
$this->prepend('<i class="fa fa-calendar"></i>')
->defaultAttribute('style', 'width: 110px');
return parent::render();
}
public function prepend($string)
{
if (is_null($this->prepend)) {
$this->prepend = $string;
}
return $this;
}
protected function defaultAttribute($attribute, $value)
{
if (!array_key_exists($attribute, $this->attributes)) {
$this->attribute($attribute, $value);
}
return $this;
}
}`
Can you add this feature that we can use our Date system for example : https://github.com/morilog/jalali
tanks