title: Fluent Validation Greater than or equal to dates
body: <p>Hi I am allowing a client to make events to display, those dates have <code>ToDate</code> and <code>FromDate</code>, I need to check the <code>ToDate</code> is in the future or the same as the <code>FromDate</code>; I used this fluent validation.</p>
  
  <pre><code>    public class EventDateValidator : AbstractValidator&lt;Event&gt;
  {
      public EventDateValidator()
      {
          RuleFor(evd =&gt; evd.FromDate)
           .NotEmpty().WithMessage("*Required");
  
          RuleFor(evd =&gt; evd.ToDate)
          .NotEmpty().WithMessage("*Required")
          .GreaterThanOrEqualTo(r =&gt; r.FromDate)
          .WithMessage("Date To must be after Date From");
      }
  }
  </code></pre>
  
  <p>The only problem is that when the create form loads a null ref error is thrown:</p>
  
  <blockquote>
    <p>An unhandled exception occurred while processing the request.
    NullReferenceException: Object reference not set to an instance of an object.
    FluentValidation.AspNetCore.MinLengthClientValidator.AddValidation(ClientModelValidationContext context) in MinLengthClientValidator.cs, line 22</p>
  </blockquote>
  
  <p>GreaterThan works just fine, but then if its a one day event validtion fails.</p>
  
  <p>This is the first time I've used fluent, so my knowledge is very limited.  I actually used this question to get me started.</p>
  
  <p><a href="https://stackoverflow.com/questions/30998626/mvc5-comparing-two-nullable-dates-with-fluent-validation">MVC5 comparing two nullable dates with fluent validation</a></p>