swift – iOS: 24 hour time formatting not honored with Area=Canada, Language=French

[ad_1]

If Language is French and Area is Canada, the Languge & Area pane in Settings exhibits 24 hour time formatting within the pattern space as anticipated, as does the remainder of iOS and inventory apps.

But when I create a easy SwiftUI app, 12 hour AM/PM formatting remains to be used.

struct ContentView: View {
    var physique: some View {
        VStack {
            Textual content("hourCycle: (Locale.present.hourCycle.rawValue)")
            Textual content(Date.now.formatted())
        }
        .padding()
    }
}

screenshot showing AM/PM in time

If I set language to English and area to United Kingdom or different 24 hour time area, I get 24 hour formatting as anticipated:

screenshot showing 24 hour time in time

If I exploit DateFormatter I see the identical challenge. Word that English-Canada makes use of AM/PM.

Is that this developer error (me!) or a bug in iOS? I attempted iOS15 (eradicating Locale.present.hourCycle as that is iOS16 solely) and see the identical challenge.

Settings:
enter image description here

[ad_2]

Leave a Reply