Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup from previous commit.

Refs #GH-1352
  • Loading branch information...
commit 68db74d32deea447c12b8e90c53fbdac1ec062d5 1 parent dc3f911
@markstory markstory authored
View
33 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -6630,27 +6630,26 @@ public function testYearAutoExpandRange() {
/**
* testInputDateMaxYear method
- *
- * Let's say we want to only allow users born from
- * 2006 to 2008 to register
- * This beeing the first singup page, we still don't have any data
+ *
+ * Let's say we want to only allow users born from 2006 to 2008 to register
+ * This being the first singup page, we still don't have any data
*
* @return void
*/
public function testInputDateMaxYear() {
- $this->Form->request->data = array();
- $this->Form->create('User');
- $result = $this->Form->input('birthday',
- array(
- 'label' => false,
- 'div' => false,
- 'type' => 'date',
- 'dateFormat' => 'DMY',
- 'minYear' => 2006,
- 'maxYear' => 2008
- )
- );
- $this->assertContains('value="2008" selected="selected"', $result);
+ $this->Form->request->data = array();
+ $this->Form->create('User');
+ $result = $this->Form->input('birthday',
+ array(
+ 'label' => false,
+ 'div' => false,
+ 'type' => 'date',
+ 'dateFormat' => 'DMY',
+ 'minYear' => 2006,
+ 'maxYear' => 2008
+ )
+ );
+ $this->assertContains('value="2008" selected="selected"', $result);
}
/**
View
5 lib/Cake/View/Helper/FormHelper.php
@@ -2359,10 +2359,9 @@ public function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $a
}
if ($attributes['value'] === null && $attributes['empty'] != true) {
- if(!empty($attributes['maxYear']) && $attributes['maxYear'] < date('Y')) {
+ $attributes['value'] = time();
+ if (!empty($attributes['maxYear']) && $attributes['maxYear'] < date('Y')) {
$attributes['value'] = strtotime(date($attributes['maxYear'] . '-m-d'));
- } else {
- $attributes['value'] = time();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.