Skip to content

Commit

Permalink
Revert "feat(COOP-2237): add new validator to check for minDate"
Browse files Browse the repository at this point in the history
This reverts commit ab26bdb.
  • Loading branch information
mmarinkov committed Aug 12, 2024
1 parent 1ba0dca commit dce30d2
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions packages/validators/src/date.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,3 @@ export function isDate(): BalValidatorFn {
return DateFns.isDate(value)
}
}

/**
* Returns `true` if the given data is at the same or after the value date
*
* ```typescript
* BalValidators.isMinDate('2000-01-01')('2000-01-01') // true
* BalValidators.isMinDate('2000-01-02')('2000-01-01') // true
* BalValidators.isMinDate(new Date(2020, 0, 1))(new Date(2020, 0, 1)) // true
* ```
*/
export function isMinDate(date: Date | string): BalValidatorFn {
return function (value: any) {
if (BalUtils.isEmpty(value)) {
return true
}
if (isString(value)) {
value = BalUtils.parse(value)
}
if (isString(date)) {
date = BalUtils.parse(date)
}
return DateFns.isSameDay(value, date) || DateFns.isAfter(value, date)
}
}

0 comments on commit dce30d2

Please sign in to comment.