/**
  * @param string $value
  */
 public function setValue($value)
 {
     $this->_value = $value;
     $normalizedFormat = DateTimeBehavior::normalizeIcuFormat($this->targetFormat, $this->behavior->formatter);
     $phpFormat = FormatConverter::convertDateIcuToPhp($normalizedFormat[1], $normalizedFormat[0], \Yii::$app->language);
     $dateTime = date_create_from_format($phpFormat, $value);
     $this->behavior->owner->{$this->originalAttribute} = $this->behavior->formatter->format($dateTime, $this->originalFormat);
 }
 /**
  * @param Model $model
  * @param $attribute
  * @param array $options
  * @param string $datePickerClass
  * @return array
  */
 public static function get(Model $model, $attribute, $options = [], $datePickerClass = 'yii\\jui\\DatePicker')
 {
     try {
         $attribute = self::findAttribute($model, $attribute);
         $format = DateTimeBehavior::normalizeIcuFormat($attribute->targetFormat, $attribute->behavior->formatter);
         switch ($datePickerClass) {
             case 'yii\\jui\\DatePicker':
                 $defaults = ['language' => \Yii::$app->language, 'clientOptions' => ['dateFormat' => 'php:' . FormatConverter::convertDateIcuToJui($format[1], $format[0])]];
                 break;
             case 'omnilight\\widgets\\DatePicker':
                 $defaults = ['language' => \Yii::$app->language, 'dateFormat' => 'php:' . FormatConverter::convertDateIcuToPhp($format[1], $format[0])];
                 break;
             default:
                 return $options;
         }
     } catch (InvalidParamException $e) {
         $defaults = [];
     }
     return ArrayHelper::merge($defaults, $options);
 }
 /**
  * @param Model $model
  * @param string $attribute
  * @param array $options
  * @param string $datePickerClass
  * @return array
  */
 public static function get(Model $model, $attribute, $options = [], $datePickerClass = DateRangePicker::class)
 {
     $behavior = self::findBehavior($model, $attribute);
     $formatAttribute = null;
     try {
         $formatAttribute = self::findAttribute($model, $behavior->startAttribute);
         $formatAttribute = self::findAttribute($model, $behavior->endAttribute);
     } catch (InvalidParamException $e) {
     }
     $defaults = [];
     switch ($datePickerClass) {
         case DateRangePicker::class:
             $defaults = ['separator' => $behavior->separator];
             if ($formatAttribute) {
                 $format = DateTimeBehavior::normalizeIcuFormat($formatAttribute->targetFormat, $formatAttribute->behavior->formatter);
                 $defaults['dateFormat'] = 'php:' . FormatConverter::convertDateIcuToPhp($format[1], $format[0]);
             }
             break;
     }
     return ArrayHelper::merge($defaults, $options);
 }