         }
     }
     
+    fileprivate var title: String? {
+        
+        switch self.dateType {
+            
+            case .none:
+                return nil
+            
+            default:
+                return GCDateFormatter.string(fromDate: self.date!, withFormat: "d", andCalendar: self.configuration.calendar)
+        }
+    }
+    
     fileprivate var font: UIFont? {
         
         switch self.dateType {

        
        didSet {
            
            if self.date == nil {
                
                self.button.isEnabled = false
                self.button.setTitle(nil, for: .normal)
                
                self.dateType = .none
            }
            else {
                
                let title = GCDateFormatter.string(fromDate: self.date!, withFormat: "d", andCalendar: self.configuration.calendar)
                
                self.button.isEnabled = true
                self.button.setTitle(title, for: .normal)
                
                if self.configuration.calendar.isDateInToday(self.date!) {
                    
                    self.dateType = .current
                }
                else if (Date() as NSDate).earlierDate(self.date!) == self.date! {
                    
                    self.dateType = .past
                }
                else {
                    
                    self.dateType = .future
                }
                
                self.configuration.calendar.isDate(self.date!, inSameDayAs: self.configuration.selectedDate()) ? self.highlight() : self.unhighlight()
            }
        }
    }
    

    
    fileprivate func formatButton() {
        
        self.button.setTitle(self.title, for: .normal)
        self.button.setTitleColor(self.textColor, for: .normal)
        self.button.titleLabel!.font = self.font
        
        switch self.dateType {
            
            case .none:
                self.button.isEnabled = false
            
            default:
                self.button.isEnabled = true
            
                if self.configuration.calendar.isDate(self.date!, inSameDayAs: self.configuration.selectedDate()) {
                    
                    self.highlight()
                }
                else {
                    
                    self.unhighlight()
                }
        }
    }
}

