diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-01-24 20:16:43 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-01-24 20:16:43 -0500 |
commit | 81d14efbd1627827a826eecd54fb17121f952921 (patch) | |
tree | 630a8b0be1f8c28c8a9f9483a198508df59b6602 /app | |
parent | d81fb20df66fd77e41f0f7d573e60b856b1e9f8a (diff) |
Simplify date and time configuration to avoid potential validation issues
Diffstat (limited to 'app')
-rw-r--r-- | app/Controller/ConfigController.php | 1 | ||||
-rw-r--r-- | app/Core/DateParser.php | 3 | ||||
-rw-r--r-- | app/Helper/DateHelper.php | 2 | ||||
-rw-r--r-- | app/Template/config/application.php | 3 |
4 files changed, 2 insertions, 7 deletions
diff --git a/app/Controller/ConfigController.php b/app/Controller/ConfigController.php index 8285ee13..8572316e 100644 --- a/app/Controller/ConfigController.php +++ b/app/Controller/ConfigController.php @@ -76,7 +76,6 @@ class ConfigController extends BaseController 'languages' => $this->languageModel->getLanguages(), 'timezones' => $this->timezoneModel->getTimezones(), 'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()), - 'datetime_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateTimeFormats()), 'time_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getTimeFormats()), 'title' => t('Settings').' > '.t('Application settings'), ))); diff --git a/app/Core/DateParser.php b/app/Core/DateParser.php index 5d3be644..9d012d12 100644 --- a/app/Core/DateParser.php +++ b/app/Core/DateParser.php @@ -13,7 +13,6 @@ use DateTime; class DateParser extends Base { const DATE_FORMAT = 'm/d/Y'; - const DATE_TIME_FORMAT = 'm/d/Y H:i'; const TIME_FORMAT = 'H:i'; /** @@ -35,7 +34,7 @@ class DateParser extends Base */ public function getUserDateTimeFormat() { - return $this->configModel->get('application_datetime_format', DateParser::DATE_TIME_FORMAT); + return $this->getUserDateFormat().' '.$this->getUserTimeFormat(); } /** diff --git a/app/Helper/DateHelper.php b/app/Helper/DateHelper.php index 7e2ec79c..3bc85b76 100644 --- a/app/Helper/DateHelper.php +++ b/app/Helper/DateHelper.php @@ -54,7 +54,7 @@ class DateHelper extends Base */ public function datetime($value) { - return date($this->configModel->get('application_datetime_format', 'm/d/Y H:i'), $value); + return date($this->dateParser->getUserDateTimeFormat(), $value); } /** diff --git a/app/Template/config/application.php b/app/Template/config/application.php index 0d7f613c..d3d8c858 100644 --- a/app/Template/config/application.php +++ b/app/Template/config/application.php @@ -23,9 +23,6 @@ <?= $this->form->select('application_date_format', $date_formats, $values, $errors) ?> <p class="form-help"><?= t('ISO format is always accepted, example: "%s" and "%s"', date('Y-m-d'), date('Y_m_d')) ?></p> - <?= $this->form->label(t('Date and time format'), 'application_datetime_format') ?> - <?= $this->form->select('application_datetime_format', $datetime_formats, $values, $errors) ?> - <?= $this->form->label(t('Time format'), 'application_time_format') ?> <?= $this->form->select('application_time_format', $time_formats, $values, $errors) ?> </fieldset> |