Commit 7986d8da authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Parse dates using the correct format from the language pack on view access page

parent 3d2946e3
...@@ -244,17 +244,17 @@ function editaccess_validate(Pieform $form, $values) { ...@@ -244,17 +244,17 @@ function editaccess_validate(Pieform $form, $values) {
$loggedinaccess = false; $loggedinaccess = false;
if ($values['accesslist']) { if ($values['accesslist']) {
foreach ($values['accesslist'] as &$item) { foreach ($values['accesslist'] as &$item) {
if (!isset($item['startdate'])) { if (empty($item['startdate'])) {
$item['startdate'] = null; $item['startdate'] = null;
} }
else if (!$item['startdate'] = strtotime($item['startdate'])) { else if (!$item['startdate'] = strptime($item['startdate'], get_string('strftimedatetimeshort'))) {
$form->set_error('accesslist', get_string('unrecogniseddateformat', 'view')); $form->set_error('accesslist', get_string('unrecogniseddateformat', 'view'));
break; break;
} }
if (!isset($item['stopdate'])) { if (empty($item['stopdate'])) {
$item['stopdate'] = null; $item['stopdate'] = null;
} }
else if (!$item['stopdate'] = strtotime($item['stopdate'])) { else if (!$item['stopdate'] = strptime($item['stopdate'], get_string('strftimedatetimeshort'))) {
$form->set_error('accesslist', get_string('invaliddate', 'view')); $form->set_error('accesslist', get_string('invaliddate', 'view'));
break; break;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment