コード例 #1
0
 /**
  * The static dates are just sample data for the user interface to help illustrate the available formats.
  * @see DropDownElement::getDropDownArray()
  */
 protected function getDropDownArray()
 {
     $dropDownData = array();
     $formats = DateSanitizerUtil::getAcceptableFormats();
     foreach ($formats as $format) {
         $firstDate = Yii::app()->dateFormatter->format($format, strtotime('30 May 1950'));
         $secondDate = Yii::app()->dateFormatter->format($format, strtotime('15 December 2011'));
         $label = Zurmo::t('ImportModule', '{firstDate} or {secondDate}', array('{firstDate}' => $firstDate, '{secondDate}' => $secondDate));
         $dropDownData[$format] = $label;
     }
     return $dropDownData;
 }
コード例 #2
0
 public function testGetAcceptableFormats()
 {
     $expected = array('yyyy-MM-dd', 'MM-dd-yyyy', 'dd-MM-yyyy', 'MM/dd/yyyy', 'M/d/yyyy', 'd/M/yyyy', 'yyyy-M-d');
     $this->assertEquals($expected, DateSanitizerUtil::getAcceptableFormats());
 }