import dayjs, {Dayjs} from 'dayjs'

export function throughDisabledCheck(
    value: Dayjs | null,
    getDisabledItem?: (value: Dayjs, today: Dayjs) => boolean
) {
    if (value) {
        const disabled = getDisabledItem && getDisabledItem(value, dayjs())

        if (disabled) {
            return null
        }
    }

    return value
}
