Add detection of invalid numbers in opening hours input element

This commit is contained in:
pietervdvn 2021-04-18 14:37:16 +02:00
parent 12afdcab75
commit 62f0ae42e0

View file

@ -189,7 +189,11 @@ export class OH {
if(spl.length != 2){
return null;
}
return {hours: Number(spl[0].trim()), minutes: Number(spl[1].trim())};
const hm = {hours: Number(spl[0].trim()), minutes: Number(spl[1].trim())};
if(isNaN(hm.hours) || isNaN(hm.minutes) ){
return null;
}
return hm;
}
public static parseHHMMRange(hhmmhhmm: string): {