I am trying to get local times for an event, and I keep getting different time depending on the type of device I am running on, either simulator, or real device. The code:
`do {
let placemarks = try await CLGeocoder().reverseGeocodeLocation(location)
if (placemarks.count) > 0 {
let localPlacemark = placemarks.first!
let timeZone = localPlacemark.timeZone!
let tzString = timeZone.abbreviation()
print("Time Zone for \(String(describing: localPlacemark.locality)) is \(tzString )")
return localPlacemark.locality ?? "Unknown Locale"
}
else {
print("Problem with the data received from geocoder")
}
}
On an iPhone 14, the timeZone.abbreviation I get (for the same location) is "EST". But on an iPhone 13, I get "GMT-5", same on an iPhone 8. All three are running iOS 16.2. Has anyone ever seen this?
Also, since I am working with a full date during daylight savings time, on the 14 the time returned is correct (DST time), but "isDaylightSavingsTime" always returns false. This makes sense since the abbreviation is "EST" and not "EDT". However, the time returned is correct. On the iPhones 13 mini and 8, the time returned is Standard and not Daylight Savings. This is truly baffling. Any insights, suggestions or help are welcome! Thank you!!