Skip to content

Commit 6caa234

Browse files
Scheduler: fix appointment of the last day of month occupy two cells in timeline view instead of one (DevExpress#30684)
1 parent 5e17283 commit 6caa234

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

packages/devextreme/js/__internal/scheduler/appointments/data_provider/m_appointment_filter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,11 @@ export class AppointmentFilterBaseStrategy {
153153
);
154154

155155
if (!hasRecurrenceRule) {
156-
if (!(endDate >= trimMin && startDate < trimMax
157-
|| dateUtils.sameDate(endDate, trimMin)
156+
const isInDisplayRange = isAllDay
157+
? endDate >= trimMin && startDate < trimMax
158+
: endDate > trimMin && startDate < trimMax;
159+
160+
if (!(isInDisplayRange || dateUtils.sameDate(endDate, trimMin)
158161
&& dateUtils.sameDate(startDate, trimMin))
159162
) {
160163
return false;

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.dataProcessor.tests.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,32 @@ module('Client side after filtering', () => {
10571057
});
10581058
});
10591059

1060+
test('Appointment should be filtered if endDate is at the edge of the trimmed end view date', function(assert) {
1061+
const dataSource = new DataSource({ store: [] });
1062+
const { appointmentDataProvider, prepareDataItems } = createAppointmentDataProvider({
1063+
key: 0,
1064+
dataSource,
1065+
isVirtualScrolling: false,
1066+
dataAccessors: defaultDataAccessors
1067+
});
1068+
1069+
appointmentDataProvider.add({
1070+
text: 'a',
1071+
startDate: new Date(2020, 5, 16, 0),
1072+
endDate: new Date(2020, 6, 16, 0),
1073+
});
1074+
1075+
const appts = appointmentDataProvider.filterLoadedAppointments({
1076+
startDayHour: 0,
1077+
endDayHour: 24,
1078+
min: new Date(2020, 6, 16, 1),
1079+
max: new Date(2020, 6, 17, 23, 59),
1080+
viewOffset: 0,
1081+
}, prepareDataItems());
1082+
1083+
assert.ok(!appts.length, 'Filtered');
1084+
});
1085+
10601086
test('Appointment should be filtered if startDate, endDate are at the edge of the trimmed end view date', function(assert) {
10611087
const dataSource = new DataSource({ store: [] });
10621088
const { appointmentDataProvider, prepareDataItems } = createAppointmentDataProvider({

0 commit comments

Comments
 (0)