Closed 0ReC0 closed 3 days ago
@Input() value: TuiDayRange
in TuiCalendarRangeComponent
not updated when click second (or more), because angular track changes by link. If link not changes => component hold old value this.items[0].range
and control value in TuiCalendarRangeComponent
don't updated
As quick hack you can use this:
setDefaultRange(): TuiDayRange {
this.value = new TuiDayRange(this.items[0].range.from, this.items[0].range.to);
}
Or use @ViewChild()
as you suggested, or through DI
Is is possible to change to check not only from and to, but also visible content of range? It should fix problem without hacs
It should fix problem without hacs
It should fix problem with double ranges with same dates, but for this problem, unfortunately, not
However, future major in could be considered to refactor control value to hold whole period, inclusive range name And for this case, perhaps, some method for setting the default period
Ok, i'll try https://github.com/taiga-family/taiga-ui/issues/7996#issuecomment-2200528532 as the solution
Playground Link
https://stackblitz.com/edit/angular-edlp9k-ry1smy?file=src%2Fapp%2Fapp.component.ts
Description
There is a behavior when the default period is required, and the user clicks on another date 2 times, in this case it should select the default period, but the calendar on the contrary is reset. It is necessary to click twice another date, there is already a hard fix to see the desired result.
I need the calendar to have a default range, for example the first one When setting null in the calendar I set the default range. In the case of "other period", the first time everything works fine, because the default range is set. The second time the calendar resets, but it should not, because I set the new value at once.
If i don't do this.tuiCalendarRangeComponent.updateValue(this.value);, then after the second click on "Other date...", the calendar is reset to the null, although i need that no matter how many times i click, it should set the default value (the first one)
Problem in video
https://github.com/taiga-family/taiga-ui/assets/41593670/d05835b2-e576-4c66-833e-ff7f7f62df68
Angular version
17.1.4
Taiga UI version
3.77.0/ (3.83.0 stackblitz)
Which browsers have you used?
Which operating systems have you used?