         let calendar = NSCalendar.currentCalendar()
         
         // Create an NSDate for the first and last day of the month
-        let components = calendar.components(NSCalendarUnit.Month, fromDate: NSDate())
+        let components = calendar.components([NSCalendarUnit.Month, NSCalendarUnit.Year], fromDate: NSDate())
         
         // Get suitable month
         components.month += monthIndex

    
    @IBAction func onDoneDatePopup(sender: UIButton) {
        

        let formatter1 = DateFormatter.MM_dd_yyyy
        let fromDate = formatter1.dateFromString((fromButton.titleLabel!.text)!)
        let toDate = formatter1.dateFromString((toButton.titleLabel!.text)!)

        let (begin, end) = getMonth(0)
        fromDate = begin
        toDate = end.dateByAddingTimeInterval(oneDay)
        
        print("from: \(DateFormatter.E_MMM_dd_yyyy.stringFromDate(fromDate!))")
        print("to: \(DateFormatter.E_MMM_dd_yyyy.stringFromDate(toDate!))")

        // TODO: set data for table view based on fromDate and toDate
        reloadDateRange()
