-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Min/max dates are not disabled in popup #3598
Comments
This seems to have been working correctly in 5.2.1 and is broken in 5.2.2 -> |
I have the same issue even with the built-in NgbDateNativeAdapter. Link to minimally-working StackBlitz that reproduces the issue:https://stackblitz.com/edit/angular-zdyuru?file=app%2Fdatepicker-popup.ts As I can see in the date-picker sourcecode the problem is that this provided adapter is used to convert @input minDate/maxDate (using toModel method) but it shouldn't as minDate/maxDate are always NgbDateStruct objects by design. this._cRef.instance.minDate = this._dateAdapter.toModel(changes.minDate.currentValue);
...
this._cRef.instance.maxDate = this._dateAdapter.toModel(changes.maxDate.currentValue); After these lines executed with the changes like this: let patch = Object.keys(options)
.map(key => this._VALIDATORS[key](options[key]))
.reduce((obj, part) => ({...obj, ...part}), {}); In my opinion, the solution is - refactor setting minDate/maxDate changes to avoid transforming them by any adapter. |
@ar41bald thanks for getting to the bottom of this issue. Confirm it was broken in Fix should be released in |
Bug description:
Dates in datepicker popup do not set to disabled state when use dynamic [minDate]/[maxDate] with custom date adapter
In a forked demo from ng-bootstrap Custom date adapter and formatter you can see that min/max is set dynamically from component class and disabled in basic UI mode, but not in a popup UI mode, if remove (comment out) custom adapter from providers array dates (min/max) are becoming disabled
Link to minimally-working StackBlitz that reproduces the issue:
https://stackblitz.com/edit/angular-oetchw
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: 8.2.14
ng-bootstrap: 5.3.0
Bootstrap: 4.4.1
The text was updated successfully, but these errors were encountered: