I use Angular 6 and Reactive Form in my project. I have a question about how to set a condition, for example if the data is empty then don't convert to date, leave it empty.
this.editForm = this.fb.group(
{
firstName: [this.user.firstName, Validators.required],
lastName: [this.user.lastName, Validators.required],
workingDate: [
moment(this.user.workingDate).format("DD/MM/YYYY"),
Validators.required
], ....
}
I want to put a conditional like if the this.user.workingDate == "" then leave it empty (if we use moment(), it will display the current date instead)
how to do that ?