mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 14:43:33 +03:00
19 lines
512 B
TypeScript
19 lines
512 B
TypeScript
// Loaded from https://deno.land/x/validasaur/src/rules/date_after_or_equal.ts
|
|
|
|
|
|
import type { Validity, Rule } from "../types.ts";
|
|
import { clearTimes, dateChecks } from "../utils.ts";
|
|
|
|
export function dateAfterOrEqual(date: Date): Rule {
|
|
return function dateAfterOrEqualRule(value: any): Validity {
|
|
return dateChecks(
|
|
value,
|
|
"dateAfterOrEqual",
|
|
{ date },
|
|
(input: Date): boolean => {
|
|
return clearTimes(input).getTime() >= clearTimes(date).getTime();
|
|
},
|
|
);
|
|
};
|
|
}
|