UNPKG

@seges/angular-validators

Version:

TypeScript 1.8.10

23 lines (18 loc) 596 B
import { IValidator } from "../IValidator"; export class MinuteValidator implements IValidator<void> { private regex: RegExp; constructor() { this.regex = new RegExp("^([0-9][0-9]):[0-5][0-9]$"); } /** * Validate the minutes input in a 24 hour time format (HH:mm) * If value is a valid minute format (00-59), return true. Otherwise return false. * @param: Full time value to test */ isValid(value: string): boolean { if (!value) { return false; } return this.regex.test(value); } }