fragaria / angular-daterangepicker

Angular.js wrapper for dangrossman/bootstrap-daterangepicker
MIT License
519 stars 372 forks source link

Date&Time picker not preselected to specified input model on singleDatePicker #200

Closed alexrada closed 5 years ago

alexrada commented 8 years ago

I'm using this directive and neither date or timepicker don't get preselected to model value. My model is saved as timestamp in miliseconds. Might this be an issue?

alexrada commented 8 years ago

So there was an issue here. I had to change the following the watch on model.startDate and model.endDate to be different when singleDatePicker is true

> if (opts.singleDatePicker) {
>                 $scope.$watch('model', function(n) {
>                 return _setStartDate(n);
>                 });
>             } else {
>                 $scope.$watch('model.startDate', function(n) {
>                 return _setStartDate(n);
>                 });
>                 $scope.$watch('model.endDate', function(n) {
>                     return _setEndDate(n);
>                 });    
>             }
mvdam commented 7 years ago

Thank you @alexrada you're a lifesaver! 🥇