mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
14 lines
450 B
TypeScript
14 lines
450 B
TypeScript
// Loaded from https://deno.land/x/validasaur/src/rules/date_before.ts
|
|
|
|
|
|
import type { Validity, Rule } from "../types.ts";
|
|
import { clearTimes, dateChecks } from "../utils.ts";
|
|
|
|
export function dateBefore(date: Date): Rule {
|
|
return function dateBeforeRule(value: any): Validity {
|
|
return dateChecks(value, "dateBefore", { date }, (input: Date): boolean => {
|
|
return clearTimes(input).getTime() < clearTimes(date).getTime();
|
|
});
|
|
};
|
|
}
|