/**
  * This method standardize events date range commonly used in all events
  * calendar routines that needs date range information. Date representation
  * is like in the following format '2016-03-01 00:00'.
  *
  * @param StdClass $dateRange Formatted date range with the month number
  *                            (->monthVal) and year value (->yearVal)
  * @return StdClass An event date range object with 'from' date value (->from)
  *                  and 'until' date value (->until)
  */
 public static function prepareEventsDateRange($dateRange = null)
 {
     if (is_null($dateRange) || !isset($dateRange->monthVal) && !isset($dateRange->yearVal)) {
         // No parameters provided, current year and month as the date range
         $fromVal = DateUtils::getFirstDayOfThisMonth();
         $untilVal = DateUtils::getLastDayOfThisMonth();
     } else {
         $fromVal = DateUtils::getFirstDayOfMonth($dateRange->monthVal, $dateRange->yearVal);
         $untilVal = DateUtils::getLastDayOfMonth($dateRange->monthVal, $dateRange->yearVal);
     }
     return (object) array('from' => $fromVal, 'until' => $untilVal);
 }