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 reveals present 24 hour time formatting, as does the remainder of iOS and inventory apps.

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

    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 take advantage of DateFormatter I see the identical situation. Notice 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 situation.

Settings:
enter image description here

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *