swc/crates/swc_bundler/tests/.cache/deno/44119fe2b09b8154b92c92707ca092e1cc5e68ed.ts
2021-11-09 20:42:49 +09:00

19 lines
516 B
TypeScript

// Loaded from https://deno.land/x/validasaur/src/rules/date_before_or_equal.ts
import type { Validity, Rule } from "../types.ts";
import { clearTimes, dateChecks } from "../utils.ts";
export function dateBeforeOrEqual(date: Date): Rule {
return function dateBeforeOrEqualRule(value: any): Validity {
return dateChecks(
value,
"dateBeforeOrEqual",
{ date },
(input: Date): boolean => {
return clearTimes(input).getTime() <= clearTimes(date).getTime();
},
);
};
}