From bae57838c2dd789064b246308c7cb3a33bba5b8e Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 5 Oct 2014 11:22:10 -0400 Subject: Input date format is now a config parameter instead of the current locale --- app/Model/DateParser.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'app/Model/DateParser.php') diff --git a/app/Model/DateParser.php b/app/Model/DateParser.php index b051fb6e..88e67686 100644 --- a/app/Model/DateParser.php +++ b/app/Model/DateParser.php @@ -57,7 +57,7 @@ class DateParser extends Base } /** - * Return the list of supported date formats + * Return the list of supported date formats (for the parser) * * @access public * @return array @@ -65,12 +65,27 @@ class DateParser extends Base public function getDateFormats() { return array( - t('m/d/Y'), + $this->config->get('application_date_format', 'm/d/Y'), 'Y-m-d', 'Y_m_d', ); } + /** + * Return the list of available date formats (for the config page) + * + * @access public + * @return array + */ + public function getAvailableFormats() + { + return array( + 'm/d/Y' => date('m/d/Y'), + 'd/m/Y' => date('d/m/Y'), + 'Y/m/d' => date('Y/m/d'), + ); + } + /** * For a given timestamp, reset the date to midnight * -- cgit v1.2.3