From b949e3e2e47c0e57d485f0f35dd3b185cd03e45f Mon Sep 17 00:00:00 2001 From: Antonin Date: Mon, 9 May 2016 15:52:03 +0200 Subject: [PATCH] Using I18N for DatePicker in addColumn --- adminstuds.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adminstuds.php b/adminstuds.php index 358951f..5750828 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -359,6 +359,7 @@ if (isset($_GET['delete_column'])) { // ------------------------------- // Add a slot // ------------------------------- + function exit_displaying_add_column($message = null) { global $smarty, $poll_id, $admin_poll_id, $poll; $smarty->assign('poll_id', $poll_id); @@ -381,10 +382,10 @@ if (isset($_POST['confirm_add_column'])) { exit_displaying_add_column(new Message('danger', __('Error', "Can't create an empty column."))); } if ($poll->format === 'D') { - $newdate = strip_tags($_POST['newdate']); + $date = DateTime::createFromFormat(__('Date', 'datetime_parseformat'), $_POST['newdate'])->setTime(0, 0, 0); + $time = $date->getTimestamp(); $newmoment = str_replace(',', '-', strip_tags($_POST['newmoment'])); - $ex = explode('/', $newdate); - $adminPollService->addDateSlot($poll_id, mktime(0, 0, 0, $ex[1], $ex[0], $ex[2]), $newmoment); + $adminPollService->addDateSlot($poll_id, $time, $newmoment); } else { $newslot = str_replace(',', '-', strip_tags($_POST['choice'])); $adminPollService->addClassicSlot($poll_id, $newslot);