Limit date input field chars and length

This commit is contained in:
Michael Shamoon committed 2022-03-11 00:11:59 -08:00
1 parent af7ffa3878
commit a1fd9f7310
4 files changed
+20 -6

No files matched your search

@@ -40,4 +40,11 @@ export class DateComponent extends AbstractInputComponent<string> implements OnI
this.value = dateFormatter.preformatDateInput(valArr.join(''))
}
}
// prevent chars other than numbers and separators
onKeyPress(event: KeyboardEvent) {
if (!/[0-9,\.\/-]+/.test(event.key)) {
event.preventDefault();
}
}
}