Merge branch '1.3' of git://github.com/cakephp/cakephp into 1.3

This commit is contained in:
Ceeram 2011-05-12 23:32:07 +02:00
commit 5c18571db1
2 changed files with 19 additions and 5 deletions

View file

@ -1832,9 +1832,8 @@ class FormHelper extends AppHelper {
if (!empty($timeFormat)) {
$time = explode(':', $days[1]);
$check = str_replace(':', '', $days[1]);
if (($check > 115959) && $timeFormat == '12') {
if (($time[0] > 12) && $timeFormat == '12') {
$time[0] = $time[0] - 12;
$meridian = 'pm';
} elseif ($time[0] == '00' && $timeFormat == '12') {

View file

@ -1887,11 +1887,10 @@ class FormHelperTest extends CakeTestCase {
}
/**
* test form->input() with datetime, date and time types
* test form->input() with time types.
*
* @return void
*/
function testInputDatetime() {
function testInputTime() {
extract($this->dateRegex);
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
$result = explode(':', $result);
@ -1929,6 +1928,22 @@ class FormHelperTest extends CakeTestCase {
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$this->assertPattern('#<option value="30"[^>]*>30</option>#', $result[1]);
$result = $this->Form->input('Random.start_time', array(
'type' => 'time',
'selected' => '18:15'
));
$this->assertPattern('#<option value="06"[^>]*>6</option>#', $result);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result);
$this->assertPattern('#<option value="pm"[^>]*>pm</option>#', $result);
}
/**
* test form->input() with datetime, date and time types
*
* @return void
*/
function testInputDatetime() {
extract($this->dateRegex);
$result = $this->Form->input('prueba', array(
'type' => 'datetime', 'timeFormat'=> 24 , 'dateFormat'=>'DMY' , 'minYear' => 2008,
'maxYear' => date('Y') + 1 ,'interval' => 15