title: ui bootstrap datepicker with unix timestamps
body: <p>I am trying to use ui-bootstrap datepicker binded to unix timestamp datas. </p>
  
  <p>to do so, i would like to use <a href="https://stackoverflow.com/a/15718899/2112538">this directive</a> which transforms the unix timestamp to a javascript date from ng-model. </p>
  
  <p><a href="http://plnkr.co/edit/q2iSLN?p=preview" rel="nofollow noreferrer"><strong>here is the code (plunker)</strong></a> </p>
  
  <pre><code>&lt;div ng-model="date" date-format&gt;
      &lt;datepicker min="minDate" show-weeks="false"&gt;&lt;/datepicker&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and the directive </p>
  
  <pre><code>  .directive('dateFormat', function() {
          return {
                require: 'ngModel',
                link: function(scope, element, attr, ngModelCtrl) {
                      ngModelCtrl.$formatters.unshift(function(timestamp) {
                            if (timestamp) return new Date( timestamp * 1000 );
                            else return "";
                      });
                      ngModelCtrl.$parsers.push(function(date) {
                            if (date instanceof Date) return Math.floor( date.getTime() / 1000 ); 
                            else return "";
                      });
                }
          };
    })
  </code></pre>
  
  <p>it's possible to select a date. The unix timestamp is correct but then, the calendar switches to 1970… </p>
  
  <p>is there a solution to make this work and use ui bootstrap's datepicker with unix timestamp datas ? </p>