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