bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

`minDate`/`maxDate` not processed correctly #9811

Closed ExtAnimal closed 3 weeks ago

ExtAnimal commented 1 month ago

Forum post

DateRangeOwner.js needs:

    afterStartDateSet(startDate, oldStartDate) {
        const
            me               = this,
            { refreshCount } = me,
            incomingEndDate  = me.hasConfig('endDate') && me.peekConfig('endDate');

        // If we are bounded by an endDate configuration, but are not in the process of being passed
        // a new endDate (unless we are at configure time), keep the end date synced with current duration.
        if (me.hasConfig('endDate') && (!incomingEndDate || me.isConfiguring)) {
            const duration = DateHelper.diff(oldStartDate || startDate, me.endDate, 'day');

            me.endDate = DateHelper.add(startDate, duration, 'day');
        }

        // If that changed the end date, the updater will have done a refresh.
        // If there was no change to the endDate, so no refresh, we have to refresh here.
        if (!me.isConfiguring && !incomingEndDate && me.refreshCount === refreshCount) {
            me._cellMap?.clear();
            me.refresh();
            me.triggerRangeChange(startDate, me.endDate);
        }
    }

But also isValidDateRange needs to coerce the passed candidate date to be within the min->max range rather than just rejecting the date, and preventing the updateDate from running