diff --git a/OutOfSchool/OutOfSchool.AuthCommon/Validators/RegisterViewModelValidator.cs b/OutOfSchool/OutOfSchool.AuthCommon/Validators/RegisterViewModelValidator.cs index 2e7b95d8ba..41e25a0b9b 100644 --- a/OutOfSchool/OutOfSchool.AuthCommon/Validators/RegisterViewModelValidator.cs +++ b/OutOfSchool/OutOfSchool.AuthCommon/Validators/RegisterViewModelValidator.cs @@ -10,9 +10,9 @@ public class RegisterViewModelValidator : AbstractValidator { public RegisterViewModelValidator(IStringLocalizer localizer) { - RuleFor(x => x.DateOfBirth).Must(x => x == null) + RuleFor(x => x.DateOfBirth).Must(x => x != DateTime.MinValue) .WithMessage(localizer["Check the entered data. This field DateOfBirth is required."]); - + RuleFor(x => x.DateOfBirth) .Must(BeAdult).When(x => !x.ProviderRegistration).WithMessage(localizer["You must be at least 18 years old."]); }