fragaria / angular-daterangepicker

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

After click the clear button, the selected range is not cleared #297

Closed Tianqi-Tang closed 5 years ago

Tianqi-Tang commented 5 years ago

After clicking the clear button, when we reopen the date picker, the original selected ranged is not cleared. Although the model has been reset to null, the startDate and endDate in DateRangePicker is not updated.

The issue seems to be related to the code:

_setDatePoint = function(setter) { return function(newValue) { if (_picker && newValue) { ===> When the newValue is null, it will not be set to the Bootstrap DataRangePicker return setter(moment(newValue)); } }; }; _setStartDate = _setDatePoint(function(m) { if (_picker.endDate < m) { _picker.setEndDate(m); } opts.startDate = m; return _picker.setStartDate(m); });