fragaria / angular-daterangepicker

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

startDate auto-defaults to today's date using singleDatePicker #183

Closed parker789 closed 5 years ago

parker789 commented 8 years ago

I'm trying to create a single date picker using the singleDatePicker = true option and passing { startDate: null, endDate: null } into the model.

After a quick run-through the code it seems one problem occurs during the modelCtrl.$formatters.push() - specifically:

var f;
f = function(date) {
  if (!moment.isMoment(date)) {
    return moment(date).format(opts.locale.format);
  } else {
    return date.format(opts.locale.format);
  }
};
if (opts.singleDatePicker && objValue) {
  return f(objValue);
}

I'm not sure if there are other pieces to the code which would need to be changed, but I unfortunately don't have time to make this fix myself at the moment.

timvandijck commented 8 years ago

This indeed is a problem, would be nice to see the pull request approved!

parker789 commented 8 years ago

Looks like this project hasn't seen much activity from the lead dev; we'll see what happens. I've gone and switched from this date picker in my project because of this among other issues.. but would still be nice to have this fixed for those still using!