protected function createMonthFlydown()
    {
        $flydown = new SwatFlydown($this->id . '_month');
        $flydown->classes = array('swat-date-entry-month');

        if ($this->show_blank_titles) {
            $flydown->blank_title = $this->getMonthBlankValueTitle();
        }

        $range_end = clone $this->valid_range_end;
        $difference = $this->valid_range_start->diff($range_end);

        // Subtract a second from the end date. This makes comparison correct,
        // and prevents displaying extra months. The difference needs to happen
        // before this to prevent December specific bugs.
        $range_end->subtractSeconds(1);

        $start_year = $this->valid_range_start->getYear();
        $end_year = $range_end->getYear();
        $start_month = $this->valid_range_start->getMonth();
        $end_month = $range_end->getMonth();

        if ($end_year == $start_year) {
            // if the years match, only display the valid months.
            for ($i = $start_month; $i <= $end_month; $i++) {
                $flydown->addOption($i, $this->getMonthOptionText($i));
            }
        } else {
            for ($i = 1; $i <= 12; $i++) {
                $flydown->addOption($i, $this->getMonthOptionText($i));
            }
        }

        return $flydown;
    }