mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
Support for empty mock times (default to 00:00:00)
This commit is contained in:
parent
72b48f4c38
commit
8b09514256
@ -276,10 +276,12 @@ class TestSessionController extends Controller {
|
||||
}
|
||||
|
||||
// Date and time
|
||||
if(@$data['datetime']['date'] && @$data['datetime']['time']) {
|
||||
if(@$data['datetime']['date']) {
|
||||
require_once 'Zend/Date.php';
|
||||
// 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')) {
|
||||
throw new LogicException(sprintf(
|
||||
'Invalid date format "%s", use yyyy-MM-dd HH:mm:ss',
|
||||
|
Loading…
Reference in New Issue
Block a user