Example #1
0
 /**
  * Generates the HTML for the form element.
  * 
  * @return string
  */
 public function __toString()
 {
     $min = get::array_def($this->attributes, 'min', false);
     $max = get::array_def($this->attributes, 'max', false);
     if ($min && (!is_object($min) || !$min instanceof cDateTime) && ($min = date_create($min, new DateTimeZone('UTC')))) {
         $this->attributes['min'] = new cDateTime(date_create($min->format('Y-m-d\\TH:i:s.uP')), cDateTime::DATETIME_KIND);
     }
     if ($max && (!is_object($max) || !$max instanceof cDateTime) && ($max = date_create($max, new DateTimeZone('UTC')))) {
         $this->attributes['max'] = new cDateTime(date_create($max->format('Y-m-d\\TH:i:s.uP')), cDateTime::DATETIME_KIND);
     }
     return parent::__toString();
 }
Example #2
0
 /**
  * Generates the HTML for the form element.
  * 
  * @return string
  */
 public function __toString()
 {
     $min = get::array_def($this->attributes, 'min', false);
     $max = get::array_def($this->attributes, 'max', false);
     //$min = new cDateTime(date_create($min->format('Y-m')));
     if ($min && (!is_object($min) || !$min instanceof cDateTime) && ($min = date_create($min))) {
         $this->attributes['min'] = new cDateTime(date_create($min->format('o-\\WW')), cDateTime::WEEK_KIND);
     }
     if ($max && (!is_object($max) || !$max instanceof cDateTime) && ($max = date_create($max))) {
         $this->attributes['max'] = new cDateTime(date_create($max->format('o-\\WW')), cDateTime::WEEK_KIND);
     }
     return parent::__toString();
 }