Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 4x 4x 6x 20x 20x 2x 18x 18x 18x 2x 16x 7x 7x 7x 7x | export const isSameDate = (a: Date, b: Date): boolean =>
a.getFullYear() === b.getFullYear() &&
a.getMonth() === b.getMonth() &&
a.getDate() === b.getDate();
export const parseTimeToMinutes = (value: string): number | null => {
const matched = /^(\d{1,2}):(\d{2})$/.exec(value);
if (!matched) {
return null;
}
const hours = Number(matched[1]);
const minutes = Number(matched[2]);
if (
Number.isNaN(hours) ||
Number.isNaN(minutes) ||
hours < 0 ||
hours > 23 ||
minutes < 0 ||
minutes > 59
) {
return null;
}
return hours * 60 + minutes;
};
export const isInvalidTimeRange = (
startTime: string,
endTime: string,
): boolean => {
const startMinutes = parseTimeToMinutes(startTime);
const endMinutes = parseTimeToMinutes(endTime);
return (
startMinutes == null || endMinutes == null || startMinutes >= endMinutes
);
};
|