Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix the tests failed
  • Loading branch information
cruisediary committed Aug 25, 2018
commit 30e011bc054bc8ab5b0e9f0aba803058cc8d05b0
6 changes: 3 additions & 3 deletions Sources/rules/Date/DateValidatorType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public enum DateValidatorType {
}
case let .shouldBeforeThen(comparison):
let result = calendar.compare(value, to: comparison, toGranularity: granularity)
if result == .orderedDescending {
if result != .orderedAscending {
throw RxValidatorResult.notBeforeDate
}
case let .shouldBeforeOrSameThen(comparison):
Expand All @@ -40,12 +40,12 @@ public enum DateValidatorType {
}
case let .shouldAfterThen(comparison):
let result = calendar.compare(value, to: comparison, toGranularity: granularity)
if result == .orderedAscending {
if result != .orderedDescending {
throw RxValidatorResult.notAfterDate
}
case let .shouldAfterOrSameThen(comparison):
let result = calendar.compare(value, to: comparison, toGranularity: granularity)
if !(result != .orderedAscending) {
if result == .orderedAscending {
throw RxValidatorResult.notAfterDate
}
case let .shouldBeCloseDates(comparison, termOfDays):
Expand Down