Correct weekday names in schedule labels
This commit is contained in:
@@ -7,7 +7,7 @@ typealias ScheduleEvery = Components.Schemas.ScheduleEvery
|
|||||||
typealias Weekday = Components.Schemas.Weekday
|
typealias Weekday = Components.Schemas.Weekday
|
||||||
|
|
||||||
private let weekdayNames: [(Weekday, String, String)] = [
|
private let weekdayNames: [(Weekday, String, String)] = [
|
||||||
(.mon, "M", "Mon"), (.tue, "T", "Tue"), (.wed, "W", "Wed"), (.thu, "T", "Thu"), (.fri, "F", "Fri"), (.sat, "S", "Sat"), (.sun, "S", "Sun"),
|
(.mon, "M", "Monday"), (.tue, "T", "Tuesday"), (.wed, "W", "Wednesday"), (.thu, "T", "Thursday"), (.fri, "F", "Friday"), (.sat, "S", "Saturday"), (.sun, "S", "Sunday"),
|
||||||
]
|
]
|
||||||
|
|
||||||
private func twoDigits(_ n: Int) -> String {
|
private func twoDigits(_ n: Int) -> String {
|
||||||
@@ -42,7 +42,7 @@ func scheduleTiming(_ sc: Schedule) -> String {
|
|||||||
return "Weekends at \(at)"
|
return "Weekends at \(at)"
|
||||||
}
|
}
|
||||||
let names = weekdayNames.filter { days.contains($0.0) }.map(\.2)
|
let names = weekdayNames.filter { days.contains($0.0) }.map(\.2)
|
||||||
return names.count == 1 ? "\(names[0])days at \(at)" : "\(names.joined(separator: ", ")) at \(at)"
|
return names.count == 1 ? "\(names[0])s at \(at)" : "\(names.map { String($0.prefix(3)) }.joined(separator: ", ")) at \(at)"
|
||||||
case .month:
|
case .month:
|
||||||
return "Monthly on the \(ordinal(sc.dayOfMonth)) at \(at)"
|
return "Monthly on the \(ordinal(sc.dayOfMonth)) at \(at)"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user