malcommac / SwiftDate

🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
MIT License
7.64k stars 768 forks source link

Binary operator '+' cannot be applied to operands of type 'DateInRegion' and 'Date' #759

Open hansong8675 opened 4 years ago

hansong8675 commented 4 years ago
    let date1 = ("2010-05-20 15:30:00".toDate()! + 3.months - 2.days)
    print("date1"+(date1.description ))
    let date2 = Date() + 3.hours
    print("date2"+(date2.description ))
    let date3 = date1 + [.year:1, .month:2, .hour:5]

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️XXXXXXXXXX let date4 = date1 + date2 ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️XXXXXXXXXX // extract single time unit components from date manipulation let over1Year = (date3 - date2).year > 1