1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.IsDate = exports.isDate = exports.IS_DATE = void 0;
|
4 | const ValidateBy_1 = require("../common/ValidateBy");
|
5 | exports.IS_DATE = 'isDate';
|
6 |
|
7 |
|
8 |
|
9 | function isDate(value) {
|
10 | return value instanceof Date && !isNaN(value.getTime());
|
11 | }
|
12 | exports.isDate = isDate;
|
13 |
|
14 |
|
15 |
|
16 | function IsDate(validationOptions) {
|
17 | return (0, ValidateBy_1.ValidateBy)({
|
18 | name: exports.IS_DATE,
|
19 | validator: {
|
20 | validate: (value, args) => isDate(value),
|
21 | defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a Date instance', validationOptions),
|
22 | },
|
23 | }, validationOptions);
|
24 | }
|
25 | exports.IsDate = IsDate;
|
26 |
|
\ | No newline at end of file |