`DateIntervalFormatter` only produces 12 hour strings, not producing 24 hour strings

let formatter = DateIntervalFormatter()
formatter.dateStyle = .none
formatter.timeStyle = .none
formatter.dateTemplate = "EEEjm"

Produces, in my locale and on my device with 24 hour time on:

"Tue, 6:39 – 7:10 pm"

I was expecting:

"Tue, 18:39 – 19:10"

Other date formatters are showing 24 hour time using the j symbol. For example:

let formatter = DateFormatter()
formatter.dateStyle = .none
formatter.timeStyle = .none
formatter.setLocalizedDateFormatFromTemplate("EEEjm")

Produces, for the start and end dates:

Tue 18:39
Tue 19:10

Further, NSDateIntervalFormatter.h suggests I should be able to use symbols like j.

So why can't I create strings in 24 hour time with DateIntervalFormatter?

Thanks for your time.

iOS 16.7.1 / Xcode 15

This appears to be a bug. Please file a feedback report, including some sample code, and reference the number here.

In the meantime, you can get 24-hour time with an hour cycle locale value:

formatter2.locale = Locale(identifier: "en_US@hours=h23")
`DateIntervalFormatter` only produces 12 hour strings, not producing 24 hour strings
 
 
Q