Symfony\Component\Form\TimeField::isSecondWithinRange PHP Method

isSecondWithinRange() public method

The second is valid if it is contained in the list passed to the field's option "seconds".
public isSecondWithinRange ( ) : boolean
return boolean
    public function isSecondWithinRange()
    {
        $date = $this->getNormalizedData();

        return $date === null || in_array($date->format('s'), $this->getOption('seconds'));
    }

Usage Example

コード例 #1
0
 public function testIsSecondWithinRange_returnsFalseIfNotContained()
 {
     $field = new TimeField('name', array('seconds' => array(6, 7), 'with_seconds' => true));
     $field->submit(array('hour' => '04', 'minute' => '05', 'second' => '08'));
     $this->assertFalse($field->isSecondWithinRange());
 }