syntactic sugar for week days
Closed this issue · 3 comments
Evertt commented
With something like this:
enum Weekday { case monday, tuesday, wednesday, thursday, friday, saturday, sunday }
extension Date {
static func next(weekday: Weekday) -> Date {
// some code
}
static func last(weekday: Weekday) -> Date {
// some code
}
}
you can write things like:
func wait(until: Date) {}
wait(until: .next(.wednesday))
naoty commented
What date does .next(.wednesday)
return?
Evertt commented
It would return next wednesday at 12:00 AM, just like .tomorrow
returns 12:00 AM tomorrow.
naoty commented
I see. I think the usecase where you want to get the next/last Wednesday is a bit rare. So, if there are many requests for this feature, I will consider this feature.