docs: function getPeriod(dates, granularity, forced) {
    var isArray = angular.isArray(dates);
    var isRange = (isArray && dates.length > 1);
  
    if ((isArray && dates.length === 0) || dates === null || dates === undefined) {
      return null;
    }
  
    if (granularity === 'month') {
      return (isRange || forced) ? getMonthPeriod(dates) : getYearPeriod(dates);
    }
  
    if (granularity === 'day') {
      return (isRange || forced) ? getDayPeriod(dates) : getMonthPeriod(dates);
    }
  
    if (granularity === 'week' && !isRange) {
      // Special case. Week is no actual granularity. This returns a week period
      // starting at the specified date. No checks are made to determine if the
      // provided date actually is the first day in a week.
      var start = (isArray) ? dates[0] : dates;
      var end = new Date(start.getTime());
      end.setDate(end.getDate() + 6);
  
      return getDayPeriod([start, end]);
    }
  
    return getDayPeriod(dates);
  }