Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 17 Issue with DateFormatter with respect to Locale. #825

Open
swamiDev080390 opened this issue Jul 29, 2024 · 0 comments
Open

iOS 17 Issue with DateFormatter with respect to Locale. #825

swamiDev080390 opened this issue Jul 29, 2024 · 0 comments

Comments

@swamiDev080390
Copy link

swamiDev080390 commented Jul 29, 2024

We observed that the Locale in the Foundation framework is giving different type of value for iOS 16 and iOS 17. We are assuming that the Locale returned in iOS 17 is causing issues in getting the time in AM/PM from 24 Hours format with DateFormatter when user changes the time format from 24 Hours to 12 hours respectively. Need assistance to resolve the issue.

DateRepresentable.swift -> Line Number 497.


func formatterForRegion(format: String? = nil, configuration: ((inout DateFormatter) -> Void)? = nil) -> DateFormatter {
		var formatter = self.formatter(format: format, configuration: {
            $0.timeZone = self.region.timeZone
			$0.calendar = self.calendar
			$0.locale = self.region.locale
		})
		configuration?(&formatter)
		return formatter
	}

image

Logs from XCode Console when TimeFormat in Device Settings is 12 Hours.
iOS 17
*** formatterForRegion: format = Optional("ha")
*** toString: .custom format = ha, Value = 15

iOS 16
*** formatterForRegion: format = Optional("ha")
*** toString: .custom format = ha, Value = 3PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant