Exemple #1
0
 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if ($name == "value") {
         if ($this->raw_data) {
             return implode(" ", $this->raw_data);
         }
         if ($this->data instanceof \Carbon\Carbon) {
             return $this->data->startOfDay()->formatLocalized($this->format);
         } elseif ($this->data instanceof \DateTime) {
             return \Carbon\Carbon::instance($this->data)->startOfDay()->formatLocalized($this->format);
         } else {
             return '';
         }
     }
     return parent::__get($name);
     // @codeCoverageIgnore
 }
 /**
  * DateTimeField constructor.
  *
  * @param array $options
  *   $form
  */
 public function __construct(array $options = [])
 {
     $options = array_merge(["widget" => new DateTimeInput()], $options);
     parent::__construct($options);
 }