To solve this we need two formatters, one for the date and one NumberFormatter for formatting 1 into 1st etc. Note that to get the order of the specific weekday in the month we use the date component .weekdayOrdinal
.
The date pattern also needs to be changed to E from EEEE to show the abbreviated day name and month needs to be MMMM to show the full month name
let formatter = DateFormatter()
formatter.dateFormat = "E MMMM"
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .ordinal
let now = stats.getData()
let day = Calendar.current.component(.weekdayOrdinal, from: now)
let ordinalDay = numberFormatter.string(from: NSNumber(value: day)) ?? String(day)
let dateString = "\(ordinalDay) \(formatter.string(from: now))"