⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@sjbur
Copy link
Contributor

@sjbur sjbur commented Jan 13, 2026

No description provided.

@sjbur sjbur self-assigned this Jan 13, 2026
@sjbur sjbur added the 26_1 label Jan 13, 2026
@sjbur sjbur marked this pull request as ready for review January 14, 2026 12:47
@sjbur sjbur requested a review from a team as a code owner January 14, 2026 12:47
Copilot AI review requested due to automatic review settings January 14, 2026 12:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix the Scheduler appointment collector button to display correct date information when timezone conversion is applied. The fix refactors the _getDateText method to use timeZoneCalculator.createDate for timezone conversion and adds a TestCafe test to verify the behavior.

Changes:

  • Refactored _getDateText method to convert dates to grid timezone before formatting
  • Removed unused _getStartDate and _getEndDate helper methods
  • Added TestCafe test for appointment collector timezone handling

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/devextreme/js/__internal/scheduler/m_compact_appointments_helper.ts Refactored date text generation to apply timezone conversion; removed unused helper methods
e2e/testcafe-devextreme/tests/scheduler/timezones/appointmentCollectorTimezone.ts Added new TestCafe test to verify collector displays correct date after timezone conversion

Comment on lines +33 to +34
startDate: new Date('2021-03-05T23:45:00.000Z'),
endDate: new Date('2021-03-05T18:15:00.000Z'),
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The startDate is after the endDate, which is logically incorrect. The startDate is 23:45 UTC while the endDate is 18:15 UTC on the same day. This means the appointment would start 5 hours and 30 minutes after it ends, which doesn't make sense. The dates should be swapped or corrected so that startDate comes before endDate.

Suggested change
startDate: new Date('2021-03-05T23:45:00.000Z'),
endDate: new Date('2021-03-05T18:15:00.000Z'),
startDate: new Date('2021-03-05T18:15:00.000Z'),
endDate: new Date('2021-03-05T23:45:00.000Z'),

Copilot uses AI. Check for mistakes.
return date ? new Date(date) : null;
}
_getDateText(appointment) {
const { startDate, endDate } = appointment;
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The direct destructuring of startDate and endDate from the appointment object bypasses the data accessor system. The old implementation used this.instance._dataAccessors.get('startDate', appointment) and this.instance._dataAccessors.get('endDate', appointment), which correctly handles custom field name mappings when users configure options like startDateExpr and endDateExpr. Direct property access will break when custom field names are used. The code should use the data accessors instead.

Suggested change
const { startDate, endDate } = appointment;
const startDate = this.instance._dataAccessors.get('startDate', appointment);
const endDate = this.instance._dataAccessors.get('endDate', appointment);

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 14, 2026 15:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Comment on lines +33 to +34
startDate: new Date('2021-03-05T23:45:00.000Z'),
endDate: new Date('2021-03-05T18:15:00.000Z'),
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The endDate (2021-03-05T18:15:00.000Z) is earlier than the startDate (2021-03-05T23:45:00.000Z), which creates an invalid appointment with negative duration. The endDate should be after the startDate. For example, it should be '2021-03-06T01:15:00.000Z' to represent a valid appointment.

Copilot uses AI. Check for mistakes.
Comment on lines +50 to 51
// @ts-expect-error
$button.data('items'),
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The @ts-expect-error directive lacks an explanation. Add a comment describing why the type error is expected, such as the mismatch between jQuery's data() method return type and the expected parameter type.

Copilot uses AI. Check for mistakes.
Comment on lines +104 to 105
// @ts-expect-error
return this.instance._createComponent($button, Button, {
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The @ts-expect-error directive lacks an explanation. Add a comment describing why the type error is expected, such as potential type incompatibility in the _createComponent method signature.

Copilot uses AI. Check for mistakes.
const date = appointment.endDate;
return date ? new Date(date) : null;
}
_getDateText(appointment, targetedAppointment?) {
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The targetedAppointment parameter should have an explicit type annotation. Based on the usage of displayStartDate and displayEndDate properties, this should be typed as TargetedAppointment | undefined (from the types.ts file) to provide better type safety and IDE support.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant