Merge pull request #8102 from monishdeb/CRM-18349
[civicrm-core.git] / CRM / Core / Page / AJAX / Location.php
index b0d13d58bc2fc355c8affba6f309c89652455002..4d128c1228866e60e50a6d6749cebff5d045f3ef 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
  *
  */
 
@@ -180,8 +180,8 @@ class CRM_Core_Page_AJAX_Location {
           }
           elseif ($htmlType == 'Select Date') {
             $elements["onbehalf_{$key}"]['type'] = $htmlType;
-            $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
-            $elements["onbehalf_{$key}_display"]['value'] = $defaults[$key];
+            //CRM-18349, date value must be ISO formatted before being set as a default value for crmDatepicker custom field
+            $elements["onbehalf_{$key}"]['value'] = CRM_Utils_Date::processDate($defaults[$key], NULL, FALSE, 'Y-m-d G:i:s');
           }
           else {
             $elements["onbehalf_{$key}"]['type'] = $htmlType;