title: Date_field: how to set maximum date while using Bootstrap datepicker?
body: <p>For a date variable I have the following code in different places of my app:</p>
  
  <pre><code>&lt;%= f.date_field :date, required: true, 'data-provide': 'datepicker' %&gt;
  &lt;%= f.text_field :date, required: true, 'data-provide': 'datepicker' %&gt;
  </code></pre>
  
  <p>So on some occasions it uses a <code>date_field</code> while on other occasions a <code>text_field</code>. It uses Bootstrap datepicker.</p>
  
  <p>I would like to add a maximum date that is allowed to be selected. <code>Date_field</code> offers the option <code>max</code> to set this. However, when I added this, I could still select any day in the future. So this didn't work and I thought it might be because of Bootstrap datepicker. So I also added the method that datepicker offers namely <code>endDate</code>.</p>
  
  <p>I now have the code below, but I can still select any date in the future I want. Does anyone see what I'm doing wrong?</p>
  
  <pre><code>&lt;% end_date = Time.zone.now + 100.days %&gt;
  &lt;%= f.date_field :date, required: true, 'data-provide': 'datepicker', max: end_date, id: 'date' %&gt;
  &lt;script type="text/javascript"&gt;
    $(document).ready(function(){
      $('#date').datepicker({
        endDate: end_date;
      });
    });
  &lt;/script&gt;
  
  &lt;%= f.text_field :date, required: true, 'data-provide': 'datepicker', id: 'date' %&gt;
  # Using the same JavaScript code
  </code></pre>