.sevenDaysOut

๐Ÿ“— ๅƒ่€ƒ๏ผšSwift Playgrounds (Date Planner - Event Model)

// Convenience methods for dates.
extension Date {
    // โญ๏ธ 7 ๅคฉๅพŒ
    // ex: Date.now.sevenDaysOut
    var sevenDaysOut: Date {
        Calendar.autoupdatingCurrent.date(byAdding: .day, value: 7, to: self) ?? self
    }
    
    // โญ๏ธ 30 ๅคฉๅพŒ
    // ex: Date.now.thirtyDaysOut
    var thirtyDaysOut: Date {
        Calendar.autoupdatingCurrent.date(byAdding: .day, value: 30, to: self) ?? self
    }
}

Last updated