angular-datepicker
angular-datepicker copied to clipboard
Backspace not clean ng-model value
Hi,
when I selected datetime ,it works no problem but if I used backspace,it clean value in datepicker but ng-model value still remains.How can I clean up ng-model value in that case
Regards
Same here. any updates?
I cant find solution yet ,can anybody help?
Hey, I've submitted a pull request with a fix, so it will trigger ng-model update if everything is backspaced.
https://github.com/kuzzmi/angular-datepicker/commit/bb1c199804a403f4bef0d1c9bcab9b0cdc643435
You can check the difference and temporarily manually apply this patch.
Essentially the diff is:
//Moment format filter.
Module.filter('mFormat', function () {
return function (m, format, tz) {
if (!(moment.isMoment(m))) {
return (m) ? moment(m).format(format) : '';
}
return tz ? moment.tz(m, tz).format(format) : m.format(format);
};
});
...
function parser(viewValue) {
if (viewValue.length === format.length) {
return viewValue;
}
return (viewValue.length === 0) ? viewValue : undefined;
}