new shizzle for nizzle

This commit is contained in:
2025-03-12 23:44:29 +01:00
parent 6b72efe9d0
commit c3663e4c6e
19 changed files with 179 additions and 71 deletions

View File

@@ -0,0 +1,18 @@
import {AbstractControl, ValidationErrors, ValidatorFn} from '@angular/forms';
export function timeAfterStartValidator(startTimeField: string): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null => {
const startTime = control.parent?.get(startTimeField)?.value;
const endTime = control.value;
if (!startTime || !endTime) {
return null; // Niet valideren als een van beide leeg is
}
// Omzetten naar Date-objecten voor vergelijking
const start = new Date(`1970-01-01T${startTime}:00`);
const end = new Date(`1970-01-01T${endTime}:00`);
return end > start ? null : {endTimeInvalid: true};
};
}