问题
I'm trying to validate a DateFrom field so that it's gives an error message whenever the user inputs the date before or equal to todays date. But somehow the method I'm using doesn't work (no error message is shown). Any suggestions? I'm required to use RuleBuilder and this is my first time using it.
My current code:
RuleFor(x => x.DateFrom)
.NotNull()
.DataType(DataType.Date)
.GreaterThanOrEqualTo(DateTime.Now)
.WithMessage("Date To must be after Date From")
.AdditionalMetadata("class", "dateInputFieldExtended")
来源:https://stackoverflow.com/questions/65410613/rulebuilder-comparing-datefrom-with-datetime-now