如果有结束日期,我想验证结束日期应该是最大或等于生效日期
effectiveDate: validator('presence', {
presence: true,
message: 'Please enter a valid value'
}),
endDate: validator('presence', {
value(model, attribute) {
// Validate a value that is not the current attribute
var effectiveDate = new Date(this.get('model').get('effectiveDate'));
var endDate = new Date(this.get('model').get('endDate'));
presence: effectiveDate > endDate;
},
message: 'Please enter a date value'
})
结束日期不是强制性的