Beispiel #1
0
 /**
  * Display the input
  *
  * @return string The HTML result of displaying
  */
 public function display()
 {
     if (is_numeric($this->value)) {
         $this->value = $this->value ? date($this->format, $this->value) : '';
     } else {
         if ($this->value === '0000-00-00' || $this->value === '0000-00-00 00:00:00') {
             $this->value = '';
         } elseif ($this->value == '') {
             $this->value = date($this->format, time());
         } else {
             $this->value = date($this->format, strtotime($this->value));
         }
     }
     $this->pattern = Lang::get('main.date-moment-pattern');
     $this->class .= ' datetime';
     /*** Format the value ***/
     $picker = array('format' => Lang::get('main.date-mask'), 'orientation' => 'right');
     if ($this->max) {
         $picker['endDate'] = $this->max;
     }
     if ($this->min) {
         $picker['startDate'] = $this->min;
     }
     $this->picker = json_encode($picker);
     return parent::display();
 }