diff --git a/packages/devextreme/js/__internal/scheduler/appointments/m_settings_generator.ts b/packages/devextreme/js/__internal/scheduler/appointments/m_settings_generator.ts index 024f19b7d244..2a87af04b019 100644 --- a/packages/devextreme/js/__internal/scheduler/appointments/m_settings_generator.ts +++ b/packages/devextreme/js/__internal/scheduler/appointments/m_settings_generator.ts @@ -323,7 +323,8 @@ export class DateGeneratorBaseStrategy { const duration = source.endDate.getTime() - source.startDate.getTime(); const startDate = this.timeZoneCalculator.createDate(source.startDate, { path: 'toGrid' }); - const endDate = dateUtilsTs.addOffsets(startDate, [duration]); + const endDate = this.timeZoneCalculator.createDate(source.endDate, { path: 'toGrid' }); + // const endDate = dateUtilsTs.addOffsets(startDate, [duration]); return { startDate, diff --git a/packages/devextreme/js/__internal/scheduler/appointments/resizing/m_core.ts b/packages/devextreme/js/__internal/scheduler/appointments/resizing/m_core.ts index 533a9190aa7f..4150895215c9 100644 --- a/packages/devextreme/js/__internal/scheduler/appointments/resizing/m_core.ts +++ b/packages/devextreme/js/__internal/scheduler/appointments/resizing/m_core.ts @@ -35,15 +35,15 @@ const getDateRangeHorizontal = (options) => { const appointmentCellsAmount = Math.round(relativeAppointmentRect.width / cellWidth); const appointmentLastCellIndex = appointmentFirstCell.index + (appointmentCellsAmount - 1); - const { sourceAppointment } = appointmentSettings.info; + const { appointment } = appointmentSettings.info; const { allDay } = appointmentSettings.info.appointment; if (handles.left) { return { startDate: appointmentFirstCell.startDate, - endDate: appointmentFirstCell.startDate > sourceAppointment.endDate + endDate: appointmentFirstCell.startDate > appointment.endDate ? appointmentFirstCell.startDate - : sourceAppointment.endDate, + : appointment.endDate, }; } @@ -60,9 +60,9 @@ const getDateRangeHorizontal = (options) => { : appointmentLastCell.startDate; return { - startDate: endDate < sourceAppointment.startDate + startDate: endDate < appointment.startDate ? endDate - : sourceAppointment.startDate, + : appointment.startDate, endDate, }; }; diff --git a/packages/devextreme/js/__internal/scheduler/r1/timezone_calculator/calculator.ts b/packages/devextreme/js/__internal/scheduler/r1/timezone_calculator/calculator.ts index 9e8580175ee1..9dad45645276 100644 --- a/packages/devextreme/js/__internal/scheduler/r1/timezone_calculator/calculator.ts +++ b/packages/devextreme/js/__internal/scheduler/r1/timezone_calculator/calculator.ts @@ -2,6 +2,7 @@ import dateUtils from '@js/core/utils/date'; import { isDefined } from '@js/core/utils/type'; import { dateUtilsTs } from '@ts/core/utils/date'; +import timeZoneUtils from '../../m_utils_time_zone'; import { PathTimeZoneConversion } from './const'; import type { DateType, TimeZoneCalculatorOptions, TimeZoneOffsetsType } from './types'; @@ -63,13 +64,22 @@ export class TimeZoneCalculator { const direction = isBack ? -1 : 1; - const resultDate = new Date(date); - return dateUtilsTs.addOffsets(resultDate, [ + let convertedDateByOffsets = dateUtilsTs.addOffsets(resultDate, [ direction * (toMs('hour') * targetOffset), -direction * (toMs('hour') * clientOffset), ]); + if (isBack) { + const DSTOffset = timeZoneUtils.getDaylightOffsetInMs(resultDate, convertedDateByOffsets); + + if (DSTOffset !== 0) { + convertedDateByOffsets = dateUtilsTs.addOffsets(convertedDateByOffsets, [DSTOffset]); + } + } + + return convertedDateByOffsets; + // V1 // NOTE: Previous date calculation engine. // Engine was changed after fix T1078292.