         }
     }
     
+    private func isDayComponent(component : Int)->Bool{
+        switch datePickerType!{
+        case .Default,.MonthDay:
+            if component == 1 {
+                return true
+            }
+        case .DayOnly:
+            if component == 0 {
+                return true
+            }
+        default :
+            return false
+        }
+        return false
+    }
+    
+    private func isMonthComponent(component : Int)->Bool{
+        switch datePickerType!{
+        case .Default,.MonthDay,.MonthOnly:
+            if component == 0 {
+                return true
+            }
+        case .YearMonth:
+            if component == 1 {
+                return true
+            }
+        default :
+            return false
+        }
+        return false
+    }
+    
+    private func isYearComponent(component : Int)->Bool{
+        switch datePickerType! {
+        case .Default:
+            if component == 2 {
+                return true
+            }
+        case .YearMonth,.YearOnly:
+            if component == 0 {
+                return true
+            }
+        default :
+            return false
+        }
+        return false
+    }
+    
+    private func isDateValidForMonth()->Bool{
+        
+        let currentMonth = _selectedComponents.month
+        let currentYear = _selectedComponents.year
+        
+        if currentMonth == 2{
+            
+            let leapYear = isLeapYear(currentYear)
+            if leapYear {
+                
+            }else{
+                
+            }
+            
+        }else if (month_31.contains(currentMonth)){
+            return true
+        }
+        else{
+            return true
+        }
+        return false
+    }
+    
+    private func isLeapYear(year : Int)->Bool{
+        if year / 100 == 0 && year / 400 == 0 {
+            
+            return true
+        }
+        else if year / 4 == 0 {
+            
+            return true
+        }
+        return false
+    }
 }

        }
        return dayArray
    }
    private let months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
    
    private var years : Array<Int>{

    
    //MARK:- Convenience Methods 
    
    private func validateDateForRow(day : Int, month : Int, year : Int){
        
        var rowToSelect = 0
        var component : Int!
        for i in 0..<self.numberOfComponents{
            if isDayComponent(i){
                rowToSelect = self.selectedRowInComponent(i)
                component = i
            }
        }
        
        if day == 31 {
            if month == 2{
                if isLeapYear(year){
                    rowToSelect -= 3
                }else{
                    rowToSelect -= 2
                }
            }else if !month_31.contains(month){
                rowToSelect -= 1
            }
        }
            
        else if day == 30 && month == 2{
            if isLeapYear(year){
                rowToSelect -= 2
            }else{
                rowToSelect -= 1
            }
        }
            
        else if day == 29 && month == 2{
            if !isLeapYear(year){
                rowToSelect -= 1
            }
        }
        
        if component != nil {
            selectRow(rowToSelect, inComponent: component, animated: true)
        }
        
        _selectedComponents.day = rowToSelect % days.count + 1
    }
    
    private func selectInitialValuesForDatePickerType(type: VJDatePickerType?){
        
        if initialComponents == nil {
            initialComponents = VJDateComponents()
        }
