Time validation pattern for Angular / Javascript

Time validator in Angular and Javascript using RegExp patterns

We want to validate an input, the required format is hh:mm


8:59 AM = 08:59

8:59 PM = 20:59

Javascript regular expression


Angular form

formControl = new FormControl('', 

Notice that we are not using a string but a JS/TS RegExp

Super fast WebApp built by Marco using SpringBoot 3 and Java 17 hosted by Infomaniak in Switzerland