Merge pull request #2454 from eileenmcnaughton/CRM-14159
[civicrm-core.git] / CRM / Utils / Date.php
index 2111970642ed2e51268bcd6aa36f9a00b7755d7e..69df6f6ec4cb265f04f8b4bad0f2822caacab25e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
   +--------------------------------------------------------------------+
-  | CiviCRM version 4.3                                                |
+  | CiviCRM version 4.4                                                |
   +--------------------------------------------------------------------+
   | Copyright CiviCRM LLC (c) 2004-2013                                |
   +--------------------------------------------------------------------+
@@ -984,6 +984,26 @@ class CRM_Utils_Date {
             $to['M'] = $now['mon'];
             $to['Y'] = $now['year'];
             break;
+
+          case 'ending_2':
+            $to['d'] = $now['mday'];
+            $to['M'] = $now['mon'];
+            $to['Y'] = $now['year'];
+            $to['H'] = 23;
+            $to['i'] = $to['s'] = 59;
+            $from    = self::intervalAdd('year', -2, $to);
+            $from    = self::intervalAdd('second', 1, $from);
+            break;
+
+          case 'ending_3':
+            $to['d'] = $now['mday'];
+            $to['M'] = $now['mon'];
+            $to['Y'] = $now['year'];
+            $to['H'] = 23;
+            $to['i'] = $to['s'] = 59;
+            $from    = self::intervalAdd('year', -3, $to);
+            $from    = self::intervalAdd('second', 1, $from);
+            break;
         }
         break;
 
@@ -1513,7 +1533,7 @@ class CRM_Utils_Date {
   static function getDateFormat($formatType = NULL) {
     $format = NULL;
     if ($formatType) {
-      $format = CRM_Core_Dao::getFieldValue('CRM_Core_DAO_PreferencesDate',
+      $format = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_PreferencesDate',
                 $formatType, 'date_format', 'name'
       );
     }