angular-strap icon indicating copy to clipboard operation
angular-strap copied to clipboard

How to set null value for date picker

Open xbrabec opened this issue 12 years ago • 4 comments

It seems it is not possible to clear the value in a date-picker. Also setting model to null results in date-picker reseting it back to min-date.

Would be nice if date picker honors the required attribute

Honza

xbrabec avatar Jan 22 '14 23:01 xbrabec

Would you please try to reproduce your issue in this plunkr?

http://plnkr.co/edit/9jDLSN4owvFc9aDkFbOS?p=preview

mgcrea avatar Jan 22 '14 23:01 mgcrea

http://plnkr.co/edit/UWY9SbVKVsVRPGlMISUE?p=preview

In fact I am able to clear the value if I set the model to undefined.

But if I just delete the text from the textbox, it makes the datepicker invalid.

I think this would be perfectly fine behavior if the value is required, but if the value is optional then there is no way how to clear the value and have the datepicker valid.

Honza

xbrabec avatar Jan 22 '14 23:01 xbrabec

It is enough to remove selected date in the plunkr and you get:

TypeError: Object # has no method 'getTime' at Object.g.update (http://mgcrea.github.io/angular-strap/static/scripts/angular-strap.min.js:8:18799) at Object.fn (http://mgcrea.github.io/angular-strap/static/scripts/angular-strap.min.js:8:21851) at Scope.$digest (http://code.angularjs.org/1.2.9/angular.js:11808:29) at Scope.$apply (http://code.angularjs.org/1.2.9/angular.js:12061:24) at HTMLInputElement.listener (http://code.angularjs.org/1.2.9/angular.js:16049:15) at http://code.angularjs.org/1.2.9/angular.js:2613:10 at forEach (http://code.angularjs.org/1.2.9/angular.js:310:20) at HTMLInputElement.eventHandler (http://code.angularjs.org/1.2.9/angular.js:2612:5)

I'm using Chrome 32.0.1700.77 (Mac).

Lukas

lukaskostial avatar Jan 29 '14 13:01 lukaskostial

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 27 '19 00:01 lock[bot]