title: Why does bootstrap-datepicker trigger 'show.bs.modal' when it is displayed?
body: <p>I have a modal, illustrated below, </p>
  
  <p><img src="https://dzwonsemrish7.cloudfront.net/items/3y1J3J012b2205043C0r/Image%202015-05-07%20at%204.14.23%20PM.png" alt=""></p>
  
  <p>When I select the input field that contains the date picker, the bootstrap modal event .on('show.bs.modal') gets triggered, which is super problematic because I'm taking all kinds of async action when the modal is legitimately shown.  I'm of the opinion that the modal is already shown and this event should not be firing.</p>
  
  <p>I have a listener on the bootstrap event 'show.bs.modal' as referenced below,</p>
  
  <pre><code>  handleModalLaunch: () -&gt;
      $(@modalClass).on 'show.bs.modal', (event) =&gt;
        return if event.dates
        promise = new Promise ( (resolve, reject) =&gt;
          @setModalData(event)
          if (@interactionData)
            resolve(@interactionData)
          else
            reject(false)
        )
        promise.then(
          (results) =&gt;
            @trigger 'setRooms', @callBacks
            @trigger 'setStudentInfo', @callBacks
          (err) -&gt;
            err
        )
  </code></pre>
  
  <p>And effectively, the listener is being triggered again which is subsequently calling the promise and associated callbacks, the triggering of the event is problematic because of course, the modal is already show and I don't want these callbacks/promise being run. </p>
  
  <p>I added <code>return if event.dates</code> (<code>event.dates</code> being a property unique to the datepicker event), to basically short circuit this code in the event that the date-picker triggered the modal show event, but of course, this is hacky and I'd like to better understand why the datepicker itself is triggering the show event.  Potentially, since my show even listener is tied to the class of the modal, the act of showing the datepicker probably inherits the target of the parent modal and is likely itself a modal, ie, the modal(datepicker) is shown and since the datepicker inherits from the parent modal, the event triggers as though it was the parent modal being 'shown'.  Have I utterly confused this? (Actually, it seems clearer to me now, but still need to understand how to fix.)</p>