Merge branch 'rls/16.0' into sharing
This commit is contained in:
@@ -28,6 +28,27 @@ class Random {
|
||||
}
|
||||
return updateTime
|
||||
}
|
||||
|
||||
static func weekdayName(fromDate date: Date) -> String {
|
||||
let weekday = Calendar.current.component(.weekday, from: date)
|
||||
let calendar = Calendar.current
|
||||
let dayIndex = ((weekday - 1) + (calendar.firstWeekday - 1)) % 7
|
||||
return calendar.weekdaySymbols[dayIndex]
|
||||
}
|
||||
|
||||
static func monthName(fromMonthInt: Int) -> String {
|
||||
let monthName = DateFormatter().monthSymbols[fromMonthInt-1]
|
||||
return monthName
|
||||
}
|
||||
|
||||
static func dayFormat(fromDate date: Date) -> String {
|
||||
let components = Calendar.current.dateComponents([.day], from: date)
|
||||
let day = components.day!
|
||||
|
||||
let formatter = NumberFormatter()
|
||||
formatter.numberStyle = .ordinal
|
||||
return formatter.string(from: NSNumber(integerLiteral: day)) ?? ""
|
||||
}
|
||||
}
|
||||
|
||||
extension Date: RawRepresentable {
|
||||
|
||||
Reference in New Issue
Block a user