Handle deprecated API in DatePickerController (#2089)
This commit is contained in:
Родитель
f7b1b2eb5b
Коммит
0fadbee237
|
@ -262,10 +262,17 @@ open class DatePickerController: NSViewController {
|
|||
|
||||
// In this case, we want to use Chinese numerals instead of western
|
||||
// Setting dateStyle to .long before setting the dateFormat will achieve this
|
||||
if calendar.identifier == .chinese && calendar.locale?.languageCode == "zh" {
|
||||
formatter.dateStyle = .long
|
||||
if calendar.identifier == .chinese {
|
||||
let languageCode: String?
|
||||
if #available(macOS 13.0, *) {
|
||||
languageCode = calendar.locale?.language.languageCode?.identifier
|
||||
} else {
|
||||
languageCode = calendar.locale?.languageCode
|
||||
}
|
||||
if languageCode == "zh" {
|
||||
formatter.dateStyle = .long
|
||||
}
|
||||
}
|
||||
|
||||
formatter.dateFormat = "d"
|
||||
|
||||
return formatter
|
||||
|
|
Загрузка…
Ссылка в новой задаче