Display local date format in date picker

This commit is contained in:
Frederic Guillot
2016-06-05 22:22:10 -04:00
parent 656f430632
commit 9cb8a1ffc9
6 changed files with 62 additions and 10 deletions

View File

@@ -93,6 +93,39 @@ class AppHelper extends Base
return $this->languageModel->getJsLanguageCode();
}
/**
* Get date format for Jquery DatePicker
*
* @access public
* @return string
*/
public function getJsDateFormat()
{
$format = $this->dateParser->getUserDateFormat();
$format = str_replace('m', 'mm', $format);
$format = str_replace('Y', 'yy', $format);
$format = str_replace('d', 'dd', $format);
return $format;
}
/**
* Get time format for Jquery Plugin DateTimePicker
*
* @access public
* @return string
*/
public function getJsTimeFormat()
{
$format = $this->dateParser->getUserTimeFormat();
$format = str_replace('H', 'HH', $format);
$format = str_replace('i', 'mm', $format);
$format = str_replace('g', 'h', $format);
$format = str_replace('a', 'tt', $format);
return $format;
}
/**
* Get current timezone
*