mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Valid strtotime() format when time is left empty
Date-type laravel validation ("date", "before", and "after") may not be used with datetime widgets containing empty time fields because they are not in a valid strtotime() format (example: 2014-12-27 :00). This extra check ensures a valid strtotime() format by only adding the ":00" seconds value when a time value is present.
This commit is contained in:
parent
9c8fcd148c
commit
8286880148
@ -126,8 +126,8 @@ class DatePicker extends FormWidgetBase
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->mode == 'datetime') {
|
||||
$value .= ' ' . post(self::TIME_PREFIX.$this->formField->getName(false)) . ':00';
|
||||
if ($this->mode == 'datetime' && $timeValue = post(self::TIME_PREFIX.$this->formField->getName(false))) {
|
||||
$value .= ' ' . $timeValue . ':00';
|
||||
}
|
||||
elseif ($this->mode == 'time') {
|
||||
$value .= ':00';
|
||||
|
Loading…
x
Reference in New Issue
Block a user