-
Notifications
You must be signed in to change notification settings - Fork 87
Description
I am getting some incorrect results on my iOS simulator with the following conditions:
- IOS simulator timezone PDT (in California)
- Lat/Lon for solar events: latitude: 32.845753, longitude: -96.852206 (Dallas, Texas)
Returned results:
solarEvent: Optional(Solar.Solar(coordinate: __C.CLLocationCoordinate2D(latitude: 32.845753, longitude: -96.852206), date: 2023-03-27 04:46:28 +0000, sunrise: Optional(2023-03-27 12:22:16 +0000), sunset: Optional(2023-03-28 00:43:56 +0000), civilSunrise: Optional(2023-03-27 11:57:33 +0000), civilSunset: Optional(2023-03-28 01:08:40 +0000), nauticalSunrise: Optional(2023-03-27 11:28:37 +0000), nauticalSunset: Optional(2023-03-28 01:37:37 +0000), astronomicalSunrise: Optional(2023-03-27 10:59:16 +0000), astronomicalSunset: Optional(2023-03-28 02:07:00 +0000)))
for lat, lon: 32.845753 -96.852206
These results in GMT are all exactly two hours earlier than would be the correct times in Dallas. This seems to correlate with the two hour time difference between my simulator (PDT) and the lat/lon given (CDT).
Possible cause:
The Solar struct initializes its property 'self.date' using Date(), which will take the time from the device. So when the solar events are requested in a timezone different from the device this can lead to a time offset.
I hope this helps!