/** * The static date times are just sample data for the user interface to help illustrate the available formats. * @see DropDownElement::getDropDownArray() */ protected function getDropDownArray() { $dropDownData = array(); $formats = DateTimeSanitizerUtil::getAcceptableFormats(); foreach ($formats as $format) { $firstDate = Yii::app()->dateFormatter->format($format, strtotime('30 May 1950 4 hours 2 minutes')); $secondDate = Yii::app()->dateFormatter->format($format, strtotime('15 December 2011 14 hours 45 minutes')); $label = Zurmo::t('ImportModule', '{firstDate} or {secondDate}', array('{firstDate}' => $firstDate, '{secondDate}' => $secondDate)); $dropDownData[$format] = $label; } return $dropDownData; }
public function testGetAcceptableFormats() { $expected = array('yyyy-MM-dd hh:mm', 'MM-dd-yyyy hh:mm', 'dd-MM-yyyy hh:mm', 'MM/dd/yyyy hh:mm', 'M/d/yyyy hh:mm', 'd/M/yyyy hh:mm', 'yyyy-M-d hh:mm'); $this->assertEquals($expected, DateTimeSanitizerUtil::getAcceptableFormats()); }