     centerDaySelector.selectedDate = selectedDate
   }
 
+  func beginningOfWeek(date: NSDate) -> NSDate {
+    let components = calendar.components([.Year, .Month, .Day, .TimeZone, .Weekday], fromDate: date)
+    let offset = components.weekday - calendar.firstWeekday
+    components.day = components.day - offset
+
+    return calendar.dateFromComponents(components)!
+  }
+
   func selectDate(selectedDate: NSDate) {
     let centerDaySelector = pagingScrollView.reusableViews[1] as! DaySelector
     let startDate = centerDaySelector.startDate.dateOnly()
 
-    let currentWeek = DTTimePeriod(size: .Week, startingAt: startDate)
+    let daysFrom = selectedDate.daysFrom(startDate, calendar: calendar)
+    print("Days From: \(daysFrom)")
 
-    if currentWeek.containsDate(selectedDate, interval: .Open) {
-      centerDaySelector.selectedDate = selectedDate//.daysFrom(startDate)
-    } else if selectedDate.isEarlierThan(currentWeek.StartDate) {
-      currentWeekdayIndex = 6
+    if daysFrom < 0 {
+      print("isEarlierThan")
       pagingScrollView.scrollBackward()
+      currentWeekdayIndex = daysInWeek - 1
+    } else if daysFrom > daysInWeek - 1 {
+      print("isLaterThan")
+      pagingScrollView.scrollForward()
+      currentWeekdayIndex = 0
+    } else {
+      print("containsDate")
+      centerDaySelector.selectedDate = selectedDate
+    }
 
-    } else if selectedDate.isLaterThan(currentWeek.EndDate) {
-      currentWeekdayIndex = 0
-      pagingScrollView.scrollForward()
-    }
     swipeLabelView.date = selectedDate
+    currentDate = selectedDate
   }
 
   override func layoutSubviews() {


  func configurePages(selectedDate: NSDate = NSDate()) {
    for i in -1...1 {
      let daySelector = DaySelector()
      let date = selectedDate.dateByAddingWeeks(i)

      daySelector.startDate = beginningOfWeek(date)


extension DayHeaderView: DaySelectorDelegate {
  func dateSelectorDidSelectDate(date: NSDate, index: Int) {
    currentDate = date
    currentWeekdayIndex = index
    swipeLabelView.date = date
    delegate?.dateHeaderDateChanged(date)
  }
}

