diff --git a/include/ajax.config.php b/include/ajax.config.php index 2a01e284071ca6122024ffc78c390759f3b48467..9cb046c7dd53fc94dc612fbace04daeda1f2851a 100644 --- a/include/ajax.config.php +++ b/include/ajax.config.php @@ -24,6 +24,7 @@ class ConfigAjaxAPI extends AjaxController { $config=array( 'lock_time' => ($cfg->getLockTime()*3600), + 'date_format' => ($cfg->getDateFormat()), 'max_file_uploads'=> (int) $cfg->getStaffMaxFileUploads() ); return $this->json_encode($config); diff --git a/include/class.ticket.php b/include/class.ticket.php index c3eb29d8db0708ab626b225a3d75318a6f33fe72..8398710cfe941abfcf8d9ce430adf64b990a5d80 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -287,6 +287,7 @@ class Ticket { } function getUpdateInfo() { + global $cfg; $info=array('name' => $this->getName(), 'email' => $this->getEmail(), @@ -297,7 +298,10 @@ class Ticket { 'topicId' => $this->getTopicId(), 'priorityId' => $this->getPriorityId(), 'slaId' => $this->getSLAId(), - 'duedate' => $this->getDueDate()?(Format::userdate('m/d/Y', Misc::db2gmtime($this->getDueDate()))):'', + 'duedate' => $this->getDueDate() + ? Format::userdate($cfg->getDateFormat(), + Misc::db2gmtime($this->getDueDate())) + :'', 'time' => $this->getDueDate()?(Format::userdate('G:i', Misc::db2gmtime($this->getDueDate()))):'', ); diff --git a/scp/js/scp.js b/scp/js/scp.js index ec2daf54261907dfaf64bc6fa64dcb71ccdf73f8..386b128da2e645754bb6da0060b8f293ff71ca13 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -278,12 +278,29 @@ $(document).ready(function(){ } /* Datepicker */ - $('.dp').datepicker({ - numberOfMonths: 2, - showButtonPanel: true, - buttonImage: './images/cal.png', - showOn:'both' - }); + getConfig().then(function(c) { + var df = c.date_format||'m/d/Y', + translation = { + 'd':'dd', + 'j':'d', + 'z':'o', + 'm':'mm', + 'F':'MM', + 'n':'m', + 'Y':'yy' + }; + // Change PHP formats to datepicker ones + $.each(translation, function(php, jqdp) { + df = df.replace(php, jqdp); + }); + $('.dp').datepicker({ + numberOfMonths: 2, + showButtonPanel: true, + buttonImage: './images/cal.png', + showOn:'both', + dateFormat: df, + }); + }); /* NicEdit richtext init */ var rtes = $('.richtext');