module.exports = Self => { function rangeValid(err) { if (this.from && this.to && this.from >= this.to) err(); } Self.validate('rangeValid', rangeValid, { message: `Start date should be lower than end date` }); };