mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-22 16:56:50 +01:00
Enable handling of time in AbstractController
and Validator
This commit is contained in:
parent
7350abadc2
commit
5284e82127
@ -52,7 +52,8 @@ abstract class AbstractController extends BaseAbstractController
|
||||
'baseUri' => $this->admin()->panelUri(),
|
||||
'DatePicker' => [
|
||||
'weekStarts' => Formwork::instance()->config()->get('date.week_starts'),
|
||||
'format' => Date::formatToPattern(Formwork::instance()->config()->get('date.format')),
|
||||
'format' => Date::formatToPattern(Formwork::instance()->config()->get('date.format') . ' ' . Formwork::instance()->config()->get('date.time_format')),
|
||||
'time' => true,
|
||||
'labels' => [
|
||||
'today' => $this->admin()->translate('date.today'),
|
||||
'weekdays' => ['long' => $this->admin()->translate('date.weekdays.long'), 'short' => $this->admin()->translate('date.weekdays.short')],
|
||||
|
@ -107,7 +107,7 @@ class Validator
|
||||
}
|
||||
|
||||
try {
|
||||
return date('Y-m-d', Date::toTimestamp($value));
|
||||
return date('Y-m-d H:i:s', Date::toTimestamp($value));
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw new ValidationException(sprintf('Invalid value for field "%s" of type "%s":%s', $field->name(), $field->type(), Str::after($e->getMessage(), ':')));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user