From 5161cde11dfdccc426d5905590d055bbafd996a7 Mon Sep 17 00:00:00 2001 From: Seyyed Parsa Neshaei Date: Tue, 6 Jul 2021 20:36:28 +0430 Subject: [PATCH] Fixing issue #759 - Binary operator '+' cannot be applied to operands of type 'DateInRegion' and 'Date' --- Sources/SwiftDate/Date/Date+Math.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/SwiftDate/Date/Date+Math.swift b/Sources/SwiftDate/Date/Date+Math.swift index 5383c9bd..9073995d 100644 --- a/Sources/SwiftDate/Date/Date+Math.swift +++ b/Sources/SwiftDate/Date/Date+Math.swift @@ -30,6 +30,11 @@ public func + (lhs: DateComponents, rhs: Date) -> Date { return (rhs + lhs) } +/// Adds 'DateInRegion' to a date and returns a new date. +public func + (lhs: Date, rhs: DateInRegion) -> Date { + return (lhs + rhs.date.dateComponents) +} + /// Subtracts date components from a date and returns a new date. public func - (lhs: Date, rhs: DateComponents) -> Date { return (lhs + (-rhs))