title: JTAppleCalendar cell background color change error in Swift 3
body: <p>Im using <code>JTAppleCalendar</code> in my project you can see it here ->  <a href="https://github.com/patchthecode/JTAppleCalendar" rel="nofollow noreferrer">https://github.com/patchthecode/JTAppleCalendar</a>. But when I want to change background colors in some cells gives me big problem , when I past previous and next months some cells background colors changing ? </p>
  
  <blockquote>
    <p>How it is possible ? How can I fix it ?  I want to change only; Example ;</p>
  </blockquote>
  
  <pre><code>let fetchRequest = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName:"Mains")
  let predicate = NSPredicate (format:"date = %@",freshdate)
  fetchRequest.predicate = predicate
  
  if let result = try? context.fetch(fetchRequest) as! [Mains] {
      for object in result {
          if(object.user! == "" &lt; freshdate) {
             cell.contentView.backgroundColor = hexStringToUIColor(hex:  "f7bca6")
          } else if(object.userme! == "") {
             cell.contentView.backgroundColor = hexStringToUIColor(hex:  "f7bca6")
          } else {
             cell.contentView.backgroundColor = hexStringToUIColor(hex:  "ffffff")
         }
      }
  }
  </code></pre>
  
  <p>Ones , but when I turn another month , in calendar looking some cells backgrounds changed.</p>
  
  <p>Under below picture shows true when app opened. </p>
  
  <p><a href="https://i.stack.imgur.com/7ZmKJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7ZmKJ.png" alt="enter image description here"></a></p>
  
  <p>But when I past previous or next month changed some cells backgrounds under below. This is mistake. I don't want to change thats.</p>
  
  <p><a href="https://i.stack.imgur.com/s3m0A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s3m0A.png" alt="enter image description here"></a></p>
  
  <p>My codes under below , where I can mistake ?</p>
  
  <pre><code>@IBOutlet weak var calendarView: JTAppleCalendarView!
  let kStartDate = "2016-01-01"
  let kEndDate = "2049-12-31"
  var numberOfRows = 6
  let formatter = DateFormatter()
  var myCalendar = Calendar(identifier: .gregorian)
  var generateInDates: InDateCellGeneration = .forAllMonths
  var generateOutDates: OutDateCellGeneration = .off
  var hasStrictBoundaries = true
  let firstDayOfWeek: DaysOfWeek = .monday
  var monthSize: MonthSize? = nil
  
  extension ViewController: JTAppleCalendarViewDelegate, JTAppleCalendarViewDataSource {
     func configureCalendar(_ calendar: JTAppleCalendarView) -&gt; ConfigurationParameters {
        formatter.dateFormat = "yyyy-MM-dd"
        formatter.timeZone = TimeZone(secondsFromGMT: 0)
        formatter.locale = Locale(identifier: "en_US")
  
        let startDate = formatter.date(from: kStartDate)!
        let endDate = formatter.date(from: kEndDate)!      
        let parameters = ConfigurationParameters(startDate: startDate,
                                                       endDate: endDate,
                                                       numberOfRows: numberOfRows,
                                                       calendar: myCalendar,
                                                       generateInDates: generateInDates,
                                                       generateOutDates: generateOutDates,
                                                       firstDayOfWeek: firstDayOfWeek,
                                                       hasStrictBoundaries: hasStrictBoundaries)
        return parameters
     }
  
     func calendar(_ calendar: JTAppleCalendarView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -&gt; JTAppleCell {
          let cell = calendar.dequeueReusableCell(withReuseIdentifier: "CellView", for: indexPath) as! CellView
          let comedate = String(describing: myCalendar.date(byAdding: .day, value: 1, to: cellState.date))
          var freshdate = comedate.substring(from: 9)
          freshdate = freshdate.substring(to: 10)
  
          let fetchRequest = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName:"Mains")
          let predicate = NSPredicate (format:"date = %@",freshdate)
          fetchRequest.predicate = predicate
  
          if let result = try? context.fetch(fetchRequest) as! [Mains] {
              for object in result {
                  if(object.user! == "" &lt; freshdate) {
                     cell.contentView.backgroundColor = hexStringToUIColor(hex:  "f7bca6")
                  } else if(object.userme! == "") {
                     cell.contentView.backgroundColor = hexStringToUIColor(hex:  "f7bca6")
                  } else {
                     cell.contentView.backgroundColor = hexStringToUIColor(hex:  "ffffff")
                  }
              }
          }
  
          handleCellConfiguration(cell: cell, cellState: cellState)
          return cell
     }
  }
  </code></pre>