diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-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 | ||||
-rw-r--r-- | tests/units/Core/DateParserTest.php | 4 |
6 files changed, 6 insertions, 9 deletions
@@ -7,6 +7,8 @@ New features: Improvements: +* Simplify date and time configuration to avoid potential validation issues + Regressions: * Stay on the same page when a task is closed 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> diff --git a/tests/units/Core/DateParserTest.php b/tests/units/Core/DateParserTest.php index 43ba4bcd..4999a06d 100644 --- a/tests/units/Core/DateParserTest.php +++ b/tests/units/Core/DateParserTest.php @@ -64,7 +64,7 @@ class DateParserTest extends Base $dates = $dateParser->getDateTimeFormats(true); $this->assertEquals('m/d/Y H:i', $dates[0]); - $this->container['configModel']->save(array('application_datetime_format' => 'd/m/Y g:i a')); + $this->container['configModel']->save(array('application_date_format' => 'd/m/Y', 'application_time_format' => 'g:i a')); $this->container['memoryCache']->flush(); $dates = $dateParser->getDateTimeFormats(); @@ -121,7 +121,7 @@ class DateParserTest extends Base { $this->container['configModel']->save(array( 'application_date_format' => 'd/m/Y', - 'application_datetime_format' => 'd/m/Y g:i a', + 'application_time_format' => 'g:i a', )); $dateParser = new DateParser($this->container); |