Simplify date and time configuration to avoid potential validation issues
This commit is contained in:
@@ -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'),
|
||||
)));
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user