We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b2dd00 commit 4c63c7bCopy full SHA for 4c63c7b
lib/validator.js
@@ -225,6 +225,18 @@ Validator.prototype.isDate = function() {
225
return this;
226
}
227
228
+Validator.prototype.isAfter = function(date) {
229
+ date = date || new Date();
230
+ var origDate = toDate(this.str);
231
+ var compDate = toDate(date);
232
+
233
+ if (origDate && compDate && origDate < compDate) {
234
+ return this.error(this.msg || 'Invalid date');
235
+ }
236
237
+ return this;
238
+}
239
240
Validator.prototype.in = function(options) {
241
if (options && typeof options.indexOf === 'function') {
242
if (!~options.indexOf(this.str)) {
@@ -269,3 +281,4 @@ Validator.prototype.isArray = function() {
269
281
270
282
271
283
284
0 commit comments