Skip to content

Commit

Permalink
Merge branch 'hotfix/1.1.4' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mouredev committed Aug 17, 2021
2 parents 7266979 + 449d324 commit 0c99b5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Twitimer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@
"@executable_path/Frameworks",
);
MACH_O_TYPE = mh_execute;
MARKETING_VERSION = 1.1.3;
MARKETING_VERSION = 1.1.4;
PRODUCT_BUNDLE_IDENTIFIER = com.mouredev.Twitimer;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -1110,7 +1110,7 @@
"@executable_path/Frameworks",
);
MACH_O_TYPE = mh_execute;
MARKETING_VERSION = 1.1.3;
MARKETING_VERSION = 1.1.4;
PRODUCT_BUNDLE_IDENTIFIER = com.mouredev.Twitimer;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
16 changes: 12 additions & 4 deletions Twitimer/Util/Extension/DateExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ extension Date {

let dayOfWeek = calendar.component(.weekday, from: self)
if considerToday && dayOfWeek == searchWeekdayIndex {
if let referenceDate = referenceDate, let duration = duration, referenceDate.addingTimeInterval(60 * 60 * Double(duration)) > self {
return referenceDate
} else if Date() <= self.addingTimeInterval(60 * 60 * Double(duration ?? 0))
|| self.addingTimeInterval(60 * 60 * Double(duration ?? 0)) <= Date()
if let referenceDate = referenceDate, let duration = duration {

let referenceCalendar = Calendar(identifier: .gregorian)
var referenceDateComponent = referenceCalendar.dateComponents([.day, .month, .year, .hour, .minute, .second], from: referenceDate)
referenceDateComponent.day = calendar.component(.day, from: self)
referenceDateComponent.month = calendar.component(.month, from: self)
referenceDateComponent.year = calendar.component(.year, from: self)

if let newReferenceDate = referenceCalendar.date(from: referenceDateComponent), newReferenceDate.addingTimeInterval(60 * 60 * Double(duration)) > self {
return newReferenceDate
}
} else if self.addingTimeInterval(60 * 60 * Double(duration ?? 0)) <= Date()
|| save && self > Date() {
return self
}
Expand Down

0 comments on commit 0c99b5f

Please sign in to comment.