I need to validate if a given value matches a specific date format such as "MM/dd/YYYY."
Typescript file
onValChange(event: Date) {
const datePipe = new DatePipe('en-US');
const val = datePipe.transform(event, 'MM/dd/yyyy');
this.writeValue(moment(event));
}
HTML file
<input class="form-control form-control-sm requiredV" [(ngModel)]="dateValue"
placeholder="mm/dd/yyyy" name="dateField" id="dateField" ngbDatepicker
#dateFieldngb="ngbDatepicker" [required]="isRequired"
[ngClass]="{'isUntouched':formName.submitted}" (ngModelChange)="onValChange($event)"
(keypress)="allow_only_numbers($event)" (click)="dateFieldngb.toggle()" />
Could you please advise me on how to verify if the entered value conforms to this specific format?