- //If the unique field name differs from the db name & is set handle it here
- if (strtotime($params[$fieldName]) === FALSE) {
- throw new Exception($fieldName . " is not a valid date: " . $params[$fieldName]);
+ $params[$fieldName] = _civicrm_api3_getValidDate($params[$fieldName], $fieldName, $fieldInfo['type']);
+ }
+}
+
+/**
+ * convert date into BAO friendly date
+ * we accept 'whatever strtotime accepts'
+ *
+ * @param string $dateValue
+ * @param $fieldName
+ * @param $fieldType
+ *
+ * @throws Exception
+ * @internal param $fieldInfo
+ *
+ * @internal param $params
+ * @return mixed
+ */
+function _civicrm_api3_getValidDate($dateValue, $fieldName, $fieldType) {
+ if (is_array($dateValue)) {
+ foreach ($dateValue as $key => $value) {
+ $dateValue[$key] = _civicrm_api3_getValidDate($value, $fieldName, $fieldType);