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 | 93x 93x 87x 25x 23x 23x 12x 11x 93x 42x | import { dayjs } from '@zeedhi/core';
export function isDateAllowed(
date: Date,
dateFormat: string,
allowedDates?: ((date: string) => boolean) | string[],
): boolean {
if (!allowedDates) return true;
if (allowedDates.length === 0) return false;
const dateString = dayjs(date).format(dateFormat);
if (allowedDates instanceof Function) {
return allowedDates(dateString);
}
return allowedDates.indexOf(dateString) !== -1;
}
/**
* Translates a date format into a mask format
* @param format The format to be translated
* @returns The mask format
*/
export function toMask(format: string): string {
return format.replace(/[A-Za-z]/gi, '#');
}
|