-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Using minDate input for the datepicker fails to fire the bsValueChange after first date clicked in v5.60+ #5888
Comments
@charms9 True, I have the same issue while using Angular 9 and ngx-bootstrap version v.5.6.1 where the following code doesn't fire a
But the
Did you find a solution for it or still waiting for the issue to be fixed? |
No, the issue was still present as of v6.1. For various reasons we are changing our app to use the Material Design calendar. |
Too bad to hear that. For now, on each change detection, we'll try to update the |
@daniloff200 Do you have any knowledge about that? The issue should have been fixed #5286 |
@latusdenis Here is how I solved it in my case. The template still looks the same, just without
Inside the component I've just added few lines of code:
I hope this helps, but if you have any specific problem that is not solved with my example, feel free to message me and I'll try to help. And also I hope this will be fixed asap, so that we don't need to do this workaround anymore 😉 |
@frezo00 The proposed solution seems to not be working for me. The config gets updated however the new min date does not get applied on the picker. |
@adrianmanduc Have you tried experimenting with the
And inside the method (where you change configs) try adding:
I hope this helps 😄 |
Hi! I'm facing the same issue, any idea when this will be fixed? Thanks! |
Hello! I'm also facing the same issue and the solution proposed by @frezo00 doesn't work for me. I downgraded to 5.5.0 to get my work done, but you have any idea when this will be fixed? Thx! |
Hi, I'm stuck with similar case... Any update for this issue? Thx! ;) |
Hey, we've just run into the same issue using the inline datepicker and ended up finding a possible fix for this. The problem seems to be the This happens every time you change any input except After the config gets updated, this code in this._datepickerRef = this._datepicker
.provide({ provide: BsDatepickerConfig, useValue: this._config })
.attach(BsDatepickerInlineContainerComponent)
.to(this._elementRef)
.show(); Creates a new We had to build our own datepicker directive and manually resubscribe to the this._datepickerRef = this._datepicker
.provide({ provide: BsDatepickerConfig, useValue: this._config })
.attach(BsDatepickerInlineContainerComponent)
.to(this._elementRef)
.show();
// Creates possible memory leaks if previous subscriptions are not cleaned up!
if (this._datepickerRef.instance) {
this._subs.push(
this._datepickerRef.instance.valueChange.subscribe((value: Date) => {
this.bsValue = value;
}),
);
} This is not a perfect solution though. I opened up a PR with a more complete fix to this. |
…ngepicker-inline Introduce updateSubscriptions method to unsubscribe from previous subscriptions and to create new subscriptions on new _datepickerRef.instance Reduce calls to setConfig by introducing a shouldSetConfig flag, thereby batching complex updates together Closes valor-software#5888 where EventEmitter does not fire after Input changes
@JoschuaSchneider do you have any update on the state of this fix? I'm currently stuck in my project because your PR hasn't been approved yet. From what I see it failed some of the tests. |
I don't have an update on this yet. A few people asked already and there has been some progress on it as they are working through the open PRs. We shipped a patch of this locally and will remove it once this gets merged. The failing tests do not indicate the progress of the PR though because the PR is created from the development branch. |
Any update on this fix yet? Instances where we have start date and end date with interdependent min and max dates are again one of the use cases where this gap is prevalent. |
any update? Facing issue with ngx-bootrap 7.1.2 |
Solved this after upgrading to V8.0.0 |
After updating our app to angular 9 and ngx-bootstrap v5.6.1, we encountered an issue with the datepicker where the minDate being set causes the function supplied to (bsValueChange) to not get fired after the first time a date on the calendar is clicked. Removing the minDate attribute allows the function to be called as expected. We downgraded our ngx-bootstrap to v5.5.0 which allowed the minDate attribute to work, although it had to be changed from the output of a function call to a variable/object property.
In version 5.6.0 and up, the event fires the supplied bsValueChange function with the following:
<bs-datepicker-inline [bsValue]="displayDate" [bsConfig]="{showWeekNumbers: false}"
(bsValueChange)="updateDeadlineDate($event)" [maxDate]="calMaxDate">
...but not with
<bs-datepicker-inline [bsValue]="displayDate" [bsConfig]="{showWeekNumbers: false}"
(bsValueChange)="updateDeadlineDate($event)" [minDate]="minDate" [maxDate]="calMaxDate">
The text was updated successfully, but these errors were encountered: