title: Use knockout to bind datepicker's mindate to another datepicker
body: <p>I have a lot of pairs of datepickers. The first date picker is the beginning of the interval, the second is the end of it. Logically, it is required that the first datepicker shouldn't have value more than that second and vice versa. I wrote this code:  </p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input type="text" class="datepicker" data-bind="datepicker: firstDate, datepickerOptions: { endDate: secondDate }" /&gt;
  &lt;input type="text" class="datepicker" data-bind="datepicker: secondDate, datepickerOptions: { startDate: firstDate }" /&gt;  
  </code></pre>
  
  <p>And JS:</p>
  
  <pre><code>  function model() {
          var self = this;
  
          self.firstDate = ko.observable();
          self.secondDate = ko.observable();
    }
  
    ko.bindingHandlers.datepicker = {
      init: function(element, valueAccessor, allBindingsAccessor) {
        //initialize datepicker with some optional options
        var options = allBindingsAccessor().datepickerOptions || {};
        $(element).datepicker(options);
  
        //when a user changes the date, update the view model
        ko.utils.registerEventHandler(element, "changeDate", function(event) {
          var value = valueAccessor();
          if (ko.isObservable(value)) {
            value(event.date);
          }
        });
      },
      update: function(element, valueAccessor) {
        var widget = $(element).data("datepicker");
        //when the view model is updated, update the widget
        if (widget) {
          widget.date = ko.utils.unwrapObservable(valueAccessor());
          if (widget.date) {
            widget.setValue();
          }
        }
      }
  
    };
  
    ko.applyBindings(new model());
  
    $('body').on('focus', ".datepicker", function() {
      $(this).datepicker({
        format: 'dd.mm.yyyy',
        language: 'ru',
        forceParse: true,
        todayBtn: true,
        clearBtn: true,
        autoclose: true
      });
    });
  </code></pre>
  
  <p>Values are get binded BUT minDate is not update on date selection. Could, please, somebody point me to my mistakes?   </p>
  
  <p>Here is a <a href="https://jsfiddle.net/z11bxeoz/12/" rel="nofollow">broken JsFiddle</a> and a <a href="https://jsfiddle.net/z11bxeoz/16/" rel="nofollow">working one</a>. So as soon as I add <code>datepickerOptions</code> to my code it get broken.</p>