Is there a way to automatically fill a form created with FormBuilder with the system's date and time when it is created, instead of the default date format?
this.creationDate = moment().format(DATE_TIME_FORMAT);
I want to update the creationDate field in my form to capture the current system date and time. Here is an example snippet of code that shows how this can be achieved:
private createFromForm(): IBlog {
return {
...new Blog(),
id: this.editForm.get(['id']).value,
creationDate:
this.editForm.get(['creationDate']).value != null ? moment(this.editForm.get(['creationDate']).value, DATE_TIME_FORMAT) : undefined,
title: this.editForm.get(['title']).value,
imageContentType: this.editForm.get(['imageContentType']).value,
image: this.editForm.get(['image']).value,
appuserId: this.editForm.get(['appuserId']).value,
communityId: this.editForm.get(['communityId']).value
};
}