# Path: happenings/utils/common.py
# def inc_month(month, year):
#     """
#     Increment the month and, if neccessary, the year.
#     Both month and year should be ints.
#     """
#     month += 1
#     if month > 12:
#         month = 1
#         year += 1
#     return month, year


from datetime import timedelta, date, datetime
from django.utils.timezone import make_aware, get_default_timezone
from django.utils.six.moves import xrange
from happenings.utils.common import inc_month
                return
            self.events.append((start, self.event))
            year += 1
            num -= 1

    def _monthly(self):
        num = self.num
        start = self.event.l_start_date
        year = self.now.year
        month = self.now.month
        day = self.event.l_start_date.day
        if self.event.l_start_date > self.now:  # event starts in the future
            year = self.event.l_start_date.year
            month = self.event.l_start_date.month
        while num:
            try:
                start = start.replace(year=year, month=month)
                if self.now > start:  # if event already happened
                    month, year = inc_month(month, year)
                    continue
                # change to date() so we can compare to event.end_repeat
                start_ = date(year, month, day)
            # value error most likely means that the event's start date doesn't
            # appear this calendar month
            except ValueError:
                month, year = inc_month(month, year)
                continue
            if self.we_should_stop(start, start_):
                return
            self.events.append((start, self.event))

# Path: happenings/utils/common.py
# def inc_month(month, year):
#     """
#     Increment the month and, if neccessary, the year.
#     Both month and year should be ints.
#     """
#     month += 1
#     if month > 12:
#         month = 1
#         year += 1
#     return month, year


# Path: happenings/utils/upcoming.py
from datetime import timedelta, date, datetime
from django.utils.timezone import make_aware, get_default_timezone
from django.utils.six.moves import xrange
from happenings.utils.common import inc_month

                return
            self.events.append((start, self.event))
            year += 1
            num -= 1

    def _monthly(self):
        num = self.num
        start = self.event.l_start_date
        year = self.now.year
        month = self.now.month
        day = self.event.l_start_date.day
        if self.event.l_start_date > self.now:  # event starts in the future
            year = self.event.l_start_date.year
            month = self.event.l_start_date.month
        while num:
            try:
                start = start.replace(year=year, month=month)
                if self.now > start:  # if event already happened
                    month, year = inc_month(month, year)
                    continue
                # change to date() so we can compare to event.end_repeat
                start_ = date(year, month, day)
            # value error most likely means that the event's start date doesn't
            # appear this calendar month
            except ValueError:
                month, year = inc_month(month, year)
                continue
            if self.we_should_stop(start, start_):
                return
            self.events.append((start, self.event))

            month, year = inc_month(month, year)