         }
     }
 
+    private func updateDateComponents(dateComponents: DateComponents, toDate date: Date, withCalendar calendar: NSCalendar) -> DateComponents {
+        var newDateComponents = dateComponents
+        newDateComponents.day = calendar.component(NSCalendar.Unit.day, from: date)
+        newDateComponents.month = calendar.component(NSCalendar.Unit.month, from: date)
+        newDateComponents.year = calendar.component(NSCalendar.Unit.year, from: date)
+
+        return newDateComponents
+    }
+
     override func viewDidLoad() {
         super.viewDidLoad()
 

                }
                once = true
            }
            
            // if we're running in the simulator, find the timezone of the current coordinates and calculate the sunrise/set times for then
            // this is so that, if we're simulating our location, we still get sunset/sunrise times
            #if (arch(i386) || arch(x86_64))


        sunriseSet.calculateSunriseSunset(today)

        guard let sunrise = sunriseSet.localSunrise(),
            let sunset = sunriseSet.localSunset(),
            let calendar = NSCalendar(identifier: NSCalendar.Identifier.gregorian) else {
                return self.sunriseSetTimesLabel.text = nil
        }

        let sunriseToday = updateDateComponents(dateComponents: sunrise, toDate: today, withCalendar: calendar)

        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = "h:mm a"

        if let sunriseTime = calendar.date(from: sunriseToday),
            sunriseTime > today {
            let timeAsString = dateFormatter.string(from: sunriseTime)
            return self.sunriseSetTimesLabel.text = "Sunrise is at \(timeAsString) today"
        }

        let sunsetToday = updateDateComponents(dateComponents: sunset, toDate: today, withCalendar: calendar)

        if let sunsetTime = calendar.date(from: sunsetToday),
            sunsetTime > today {
            let timeAsString = dateFormatter.string(from: sunsetTime)
            return self.sunriseSetTimesLabel.text = "Sunset is at \(timeAsString) today"
        }
