Hi,
I am using ig-date-picker. i want to set min and max value dynamically. but its not taking it.
HTML:
<ig-date-picker #igwidget testClass="dtPicker-project-plannedStartDate" name="QProject/QProject/PlannedStartDate" [(ngModel)]="model.plannedStartDate" (valueChanged)="modifyProject('plannedStartDate', $event)" [options]="datePickerOptions"></ig-date-picker>
TS:
this.datePickerOptions ={ regional: this.language,
datepickerOptions: {
maxDate: new Date(this.maxDate) } }
but max date do not change dynamically.
Could you please help?
I removed template "#igwidget", but still its not working.
I tried running the template you are providing, but I'm getting the following error:
Error: Template parse errors:Reference "#igwidget" is defined several times ("[regional]="'en'" ></ig-date-picker>
Maybe you should use different references to date picker. I changed them to be different and then the date pickers work as expected.
Hi ,
I have two ig-datepicker.
html:
<ig-date-picker #igwidget [(ngModel)]="model.plannedStartDate" [datepickerOptions]="maxDateOption" (ngModelChange)="modifyProject('plannedStartDate', $event)" [regional]="'en'" ></ig-date-picker>
<ig-date-picker #igwidget [(ngModel)]="model.plannedEndDate" [datepickerOptions]="minDateOption" (ngModelChange)="modifyProject('plannedEndDate', $event)" [regional]="'en'" ></ig-date-picker>
public modifyProject(modified?: string, obj?: any) { if (modified === 'plannedStartDate') { this.minDateOption = { minDate: obj }; } else if (modified === 'plannedEndDate') { this.maxDateOption = { maxDate: obj }; }
}
if first date selected i set minDate and use it for second datePicker.
if second date selected i set maxDate and use it for firstdatePicker.
but issue is once i select date in first datePicker it set min value for second datePicker. after that i try to select date in second datePicker, but it takes todays date.
Hello Jeetendra,
Are you sure you are not changing the model or the plannedStartDate into your modifyProject method?
You could also attach a sample demonstrating this, so we can investigate it.
Hi Deyank,
I have tried same thing.
but when i change value of "this.model.plannedEndDate" and try to select date from date-picker it takes todays date.
When i debug this i found it makes call for modyProject('plannedStartDate', $event) twice. first is takes selected value but second time it takes todays date.
If i remove "regional" it works fine,but i have to keep it.