Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('getDeltaTime', () => {
});

['timelineDay', 'timelineWeek', 'timelineWorkWeek'].forEach((view) => {
it(`should return zero for not resized appointment in horizontal ${view} view`, () => {
it(`should return cell duration delta for resized appointment in horizontal ${view} view`, () => {
expect(getDeltaTime(
{ width: 50, height: 100 },
{ width: 100, height: 100 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const getCellData = (
// NOTE: All day appointments occupy day if they start at the beginning of the day,
// but long appointments are not. So for all day appointments endDate === startDate,
// for long appointments endDate = startDate + 1 day.
if (!isAllDay) {
if (!isAllDay && isOccupiedAllDay) {
cellData.endDate = dateUtilsTs.addOffsets(cellData.startDate, toMs('day'));
}

Expand Down
9 changes: 6 additions & 3 deletions packages/devextreme/js/__internal/scheduler/m_subscribes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ const isAllDay = (
): boolean => {
const adapter = new AppointmentAdapter(appointmentData, scheduler._dataAccessors);

if (VERTICAL_VIEW_TYPES.includes(scheduler.currentView.type)) {
return isAppointmentTakesAllDay(adapter, scheduler.option('allDayPanelMode'));
if (!VERTICAL_VIEW_TYPES.includes(scheduler.currentView.type)) {
return adapter.allDay;
}

return adapter.allDay;
return isAppointmentTakesAllDay(
adapter,
scheduler.getViewOption('allDayPanelMode'),
);
};

const subscribes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const sortAppointments = (
): SortedEntity[] => {
const {
isMonthView,
isTimelineView,
hasAllDayPanel,
snapToCellsMode,
viewOffset,
Expand All @@ -35,7 +36,7 @@ export const sortAppointments = (
sortByStartDate(group);
const innerStep0 = isMonthView || panelName === 'allDayPanel'
? expandAllDayAllDayPanel(group, endDayHour, viewOffset)
: expandAllDayRegularPanel(group);
: expandAllDayRegularPanel(group, isTimelineView);
const innerStep1 = splitByParts(innerStep0, optionManager.getSplitIntervals(panelName));
sortByDuration(innerStep1);
sortByStartDate(innerStep1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,19 @@ describe('expandAllDay', () => {
]);
});

it('should set +1 day from end date to all day appointment', () => {
it('should keep dates of all day appointment with duration', () => {
expect(expandAllDayRegularPanel([
{
allDay: true,
startDateUTC: Date.UTC(2020, 0, 10),
endDateUTC: Date.UTC(2020, 0, 10),
startDateUTC: Date.UTC(2020, 0, 10, 4),
endDateUTC: Date.UTC(2020, 0, 11, 5),
}, {
allDay: true,
startDateUTC: Date.UTC(2020, 0, 11, 23),
endDateUTC: Date.UTC(2020, 0, 12),
},
])).toEqual([
{
allDay: true,
startDateUTC: Date.UTC(2020, 0, 10, 4),
endDateUTC: Date.UTC(2020, 0, 11, 5),
Expand All @@ -113,12 +119,22 @@ describe('expandAllDay', () => {
startDateUTC: Date.UTC(2020, 0, 11, 23),
endDateUTC: Date.UTC(2020, 0, 12),
},
])).toEqual([
]);
});

it('should expand all day appointment with duration on timeline view', () => {
expect(expandAllDayRegularPanel([
{
allDay: true,
startDateUTC: Date.UTC(2020, 0, 10),
endDateUTC: Date.UTC(2020, 0, 11),
startDateUTC: Date.UTC(2020, 0, 10, 4),
endDateUTC: Date.UTC(2020, 0, 11, 5),
}, {
allDay: true,
startDateUTC: Date.UTC(2020, 0, 11, 23),
endDateUTC: Date.UTC(2020, 0, 12),
},
], true)).toEqual([
{
allDay: true,
startDateUTC: Date.UTC(2020, 0, 10, 4),
endDateUTC: Date.UTC(2020, 0, 12, 4),
Expand All @@ -129,5 +145,21 @@ describe('expandAllDay', () => {
},
]);
});

it('should set +1 day from end date to zero-duration all day appointment', () => {
expect(expandAllDayRegularPanel([
{
allDay: true,
startDateUTC: Date.UTC(2020, 0, 10),
endDateUTC: Date.UTC(2020, 0, 10),
},
])).toEqual([
{
allDay: true,
startDateUTC: Date.UTC(2020, 0, 10),
endDateUTC: Date.UTC(2020, 0, 11),
},
]);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ export const expandAllDayAllDayPanel = <T extends Pick<ListEntity, 'startDateUTC

export const expandAllDayRegularPanel = <T extends Pick<ListEntity, 'startDateUTC' | 'endDateUTC' | 'allDay'>>(
entities: T[],
isTimelineView = false,
): T[] => entities.map((entity) => {
if (!entity.allDay) {
return entity;
}

if (!isTimelineView && entity.endDateUTC > entity.startDateUTC) {
return entity;
}
Comment on lines +83 to +85

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that this comment is valid. I verified fix behavior and everything looks as intented.


const startDate = new Date(entity.startDateUTC);
const endDate = new Date(entity.endDateUTC);
endDate.setDate(endDate.getDate() + 1);
Expand Down
Loading