Support for empty mock times (default to 00:00:00)

This commit is contained in:
Ingo Schommer 2013-12-10 19:01:22 +01:00
parent 72b48f4c38
commit 8b09514256

View File

@ -276,10 +276,12 @@ class TestSessionController extends Controller {
} }
// Date and time // Date and time
if(@$data['datetime']['date'] && @$data['datetime']['time']) { if(@$data['datetime']['date']) {
require_once 'Zend/Date.php'; require_once 'Zend/Date.php';
// Convert DatetimeField format // Convert DatetimeField format
$datetime = $data['datetime']['date'] . ' ' . $data['datetime']['time']; $datetime = $data['datetime']['date'];
$datetime .= ' ';
$datetime .= (@$data['datetime']['time']) ? $data['datetime']['time'] : '00:00:00';
if(!Zend_Date::isDate($datetime, 'yyyy-MM-dd HH:mm:ss')) { if(!Zend_Date::isDate($datetime, 'yyyy-MM-dd HH:mm:ss')) {
throw new LogicException(sprintf( throw new LogicException(sprintf(
'Invalid date format "%s", use yyyy-MM-dd HH:mm:ss', 'Invalid date format "%s", use yyyy-MM-dd HH:mm:ss',