Skip to content

Commit

Permalink
#609 Fixes a bug wich return wrong results with isInRange by passing …
Browse files Browse the repository at this point in the history
…a granularity different from nanosecond
  • Loading branch information
malcommac committed Oct 26, 2018
1 parent 9e01d75 commit 2acc81e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/SwiftDate/Date/Date+Compare.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public extension Date {
/// - granularity: smallest unit that must, along with all larger units, be greater for the given dates.
/// - Returns: Boolean
public func isInRange(date startDate: Date, and endDate: Date, orEqual: Bool = false, granularity: Calendar.Component = .nanosecond) -> Bool {
return self.inDefaultRegion().isInRange(date: startDate.inDefaultRegion(), and: endDate.inDefaultRegion())
return self.inDefaultRegion().isInRange(date: startDate.inDefaultRegion(), and: endDate.inDefaultRegion(), granularity: granularity)
}

/// Compares equality of two given dates based on their components down to a given unit
Expand Down

0 comments on commit 2acc81e

Please sign in to comment.