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 @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}

Expand All @@ -60,9 +60,9 @@ const getDateRangeHorizontal = (options) => {
: appointmentLastCell.startDate;

return {
startDate: endDate < sourceAppointment.startDate
startDate: endDate < appointment.startDate
? endDate
: sourceAppointment.startDate,
: appointment.startDate,
endDate,
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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.
Expand Down
Loading