I want to get the weekdays of the user's locale, e.g., ["Mon", "Tue", "Wed", ...]
for Germany, where the week starts on Monday, and ["Sun", "Mon", "Tue", ...]
for the US, where the week starts on Sunday. But I cannot get it to work in Swift. The calendar completely ignores the system settings and always returns Sunday as the first day of the week, even when setting the calendar's locale explicitly to Germany.
I made sure the start of the week is set to Monday in the device's language settings.
Using Calendar(identifier: .iso8601)
doesn't work either - all return Sunday.
var calendar = Calendar.current
calendar.locale = Locale(identifier: "de_DE")
let date = calendar.date(from: calendar.dateComponents([.yearForWeekOfYear, .weekOfYear], from: .now))
print(calendar.locale!) // de_DE (fixed de_DE)
print(calendar.firstWeekday) // 2 - which is actually the value for Monday AFAIC
print(date!) // 2024-12-29 23:00:00 +0000 - which is NOT a Monday, it's a Sunday
print(calendar.weekdaySymbols) // ["Sun", "Mon", "Tue", ...]