Answers for "Angular material date picker add dates automatically"

0

Angular material date picker add dates automatically

As you are using Angular Reactive forms, you can listen for changes in the dateOne form control value through the valueChanges observable and set the dateTwo form control value.

this.form.get('dateOne')?.valueChanges.subscribe(date => {
  const dateTwo = formatDate(new Date()+ 7, 'MM/dd/yyyy', 'en');
  this.form.get('dateTwo')?.setValue(dateTwo);
});
Posted by: Guest on January-13-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language