title: How to set maximum date and minmum date in date picker dialog
body: <p>I would like to make the calendar show particular month and I would like to define range of allowed dates in calendar</p>
  
  <pre><code>DateTime today = DateTime.Today;
  DatePickerDialog dateDialog = new DatePickerDialog(this, this.OnToDateSet, today.Year, today.Month - 1, today.Day);
  dateDialog.DatePicker.MaxDate = DateTime.Today.Millisecond;
  dateDialog.DatePicker.MinDate = new DateTime(today.Year, today.Month - 2, today.Day).Millisecond;
  dateDialog.Show();  
  </code></pre>
  
  <p>this is what I get in return ... it shows the wrong year &amp; month when it appears</p>
  
  <p>if I comment out maxdate and mindate then calendar opens at right year and month</p>
  
  <p><a href="https://i.stack.imgur.com/HSw57.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HSw57.png" alt="enter image description here"></a></p>
  
  <p>Somebody please clarify </p>