Skip to content

Commit

Permalink
Fix compare(.isEarlier(than: ) when two days are equal (#119)
Browse files Browse the repository at this point in the history
Thanks
  • Loading branch information
alfredcc authored Mar 20, 2024
1 parent 4d72de2 commit f75829d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/DateHelper/DateHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ public extension Date {
case .isInThePast:
return self.compare(.isEarlier(than: Date()))
case .isEarlier(let date):
return (self as NSDate).earlierDate(date) == self
return timeIntervalSince1970 < date.timeIntervalSince1970
case .isLater(let date):
return (self as NSDate).laterDate(date) == self
return timeIntervalSince1970 > date.timeIntervalSince1970
case .isWeekday:
return !compare(.isWeekend)
case .isWeekend:
Expand Down

0 comments on commit f75829d

Please sign in to comment.