Page 1 of 1

DateField min/max

Posted: Tue Apr 13, 2021 10:52 am
by jeffrey1994

Hey I'm trying to set a min/max on start and end date fields of the EventEdit feature.
Currently I'm using 'beforeEventEditShow' to set min/max values.

const startDateField = aEvent.editor.query(aWidget => aWidget.ref === 'startDateField') as DateField;
startDateField.min = period.startDate; // 12-04-2021 12:00
startDateField.max = period.endDate; // 19-04-2021 12:00

const endDateField = aEvent.editor.query(aWidget => aWidget.ref === 'endDateField') as DateField;
endDateField.min = period.startDate; // 12-04-2021 12:00
endDateField.max = period.endDate; // 19-04-2021 12:00
Untitled.png
Untitled.png (43.14 KiB) Viewed 527 times

The picker seems to show correct values (e.g. 12th to 19th is enabled), however when I select the 19th it tells me it's an invalid value.

Is this a bug?


Re: DateField min/max

Posted: Tue Apr 13, 2021 1:18 pm
by alex.l

Hi jeffrey1994,

I checked it using our example in docs: https://bryntum.com/docs/scheduler/#Core/widget/DateField
With simple changes:

//invalid datefield
new DateField({
    label    : 'Invalid',
    min      : new Date(2018,4,18),
    value    : new Date(2018,4,19),
    max      : new Date(2018,4,22),
    editable : true,
    appendTo : targetElement
});

And it works great. What error do you see? Maybe you have some extra validation logic? Does it possible to reproduce in our examples for you? What version of the Scheduler do you use?

All the best,
Alex


Re: DateField min/max

Posted: Wed Apr 14, 2021 2:39 pm
by alex.l

Hi jeffrey1994,

I was able to reproduce this problem. The ticket is here: https://github.com/bryntum/support/issues/2661

Thank you for the report!
Alex.