How to use the isAfter function from validator

Find comprehensive JavaScript validator.isAfter code examples handpicked from public code repositorys.

9
10
11
12
13
14
15
16
17
18
this.equals = (comparison) => (subject) => {
    return StringValidator.equals(subject, comparison) ? null : 'Does not equal ' + comparison;
}

this.isAfter = (date) => (subject) => {
    return StringValidator.isAfter(subject, date) ? null: subject + ' is not after ' + date;
}

this.isAlpha = (subject) => {
    return StringValidator.isAlpha(subject) ? null:  subject + ' is not alpha';
fork icon1
star icon4
watch icon2

+ 3 other calls in file

47
48
49
50
51
52
53
54
55
56
    return false
  }
}

validator.isAfter = function (value, dt, format) {
  if (!dt) return validatorJs.isAfter(value)
  let m = _.isEmpty(format) ? moment(dt) : moment(dt, format)
  if (!m.isValid()) return false
  return validatorJs.isAfter(value, m.toDate())
}
fork icon0
star icon3
watch icon1

+ 7 other calls in file

134
135
136
137
138
139
140
141
142
143
  }
  return true;
},
isAfter: function(rule, value) {
  if (rule) {
    return validator.isAfter(value);
  }
  return true;
},
isBefore: function(rule, value) {
fork icon0
star icon2
watch icon2

+ 5 other calls in file

6
7
8
9
10
11
12
13
14
15
contains: validator.contains,
// equals(str, comparison) - check if the string matches the comparison.
equals: validator.equals,
// isAfter(str [, date]) - check if the string is a date that's after the specified date (defaults to now).
isAfter: function (str, date) {
  return validator.isAfter(str, typeof date !== 'boolean' ? date : undefined);
},
// isAlpha(str) - check if the string contains only letters (a-zA-Z).
isAlpha: validator.isAlpha,
// isAlphanumeric(str) - check if the string contains only letters and numbers.
fork icon0
star icon1
watch icon3

+ 17 other calls in file