Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
beforeEach, describe, expect, it, jest,
} from '@jest/globals';

import timezoneUtils from '../m_utils_time_zone';
import timezoneUtils from '../utils_time_zone';
import { createScheduler } from './__mock__/create_scheduler';

const startDate = new Date(2025, 0, 6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import { dateSerialization } from '@ts/core/utils/m_date_serialization';
import DropDownEditor from '@ts/ui/drop_down_editor/drop_down_editor';
import type Popup from '@ts/ui/popup/m_popup';

import timeZoneUtils from '../m_utils_time_zone';
import type { TimeZoneCalculator } from '../r1/timezone_calculator/calculator';
import type { CreateComponentFn, SafeAppointment } from '../types';
import type { AppointmentDataAccessor } from '../utils/data_accessor/appointment_data_accessor';
import type { ResourceLoader } from '../utils/loader/resource_loader';
import { DEFAULT_ICONS_SHOW_MODE } from '../utils/options/constants';
import { getAppointmentGroupIndex, getRawAppointmentGroupValues, getSafeGroupValues } from '../utils/resource_manager/appointment_groups_utils';
import type { ResourceManager } from '../utils/resource_manager/resource_manager';
import timeZoneUtils from '../utils_time_zone';
import { customizeFormItems } from './customize_form_items';
import { getRepeatSelectItems, REPEAT_NEVER_VALUE } from './localized_items';
import type { AppointmentPopupContext } from './popup';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
APPOINTMENT_ITEM_CLASS,
} from '../classes';
import { APPOINTMENT_SETTINGS_KEY } from '../constants';
import timeZoneUtils from '../m_utils_time_zone';
import type { CompactAppointmentOptions } from '../types';
import { AppointmentAdapter } from '../utils/appointment_adapter/appointment_adapter';
import type { AppointmentDataAccessor } from '../utils/data_accessor/appointment_data_accessor';
Expand All @@ -38,6 +37,7 @@ import {
import { getAppointmentGroupValues } from '../utils/resource_manager/appointment_groups_utils';
import { getGroupTexts } from '../utils/resource_manager/group_utils';
import type { ResourceManager } from '../utils/resource_manager/resource_manager';
import timeZoneUtils from '../utils_time_zone';
import type {
AppointmentAgendaViewModel,
AppointmentCollectorViewModel,
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme/js/__internal/scheduler/m_scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ import { hide as hideLoading, show as showLoading } from './loading';
import { CompactAppointmentsHelper } from './m_compact_appointments_helper';
import type { SubscribeKey, SubscribeMethods } from './m_subscribes';
import subscribes from './m_subscribes';
import { utils } from './m_utils';
import timeZoneUtils, { type TimezoneLabel } from './m_utils_time_zone';
import { combineRemoteFilter } from './r1/filterting/remote';
import { createTimeZoneCalculator } from './r1/timezone_calculator/index';
import {
Expand All @@ -73,6 +71,7 @@ import type {
ScrollToGroupValuesOrOptions, ScrollToOptions, TargetedAppointment,
ViewType,
} from './types';
import { utils } from './utils';
import { AppointmentAdapter } from './utils/appointment_adapter/appointment_adapter';
import { AppointmentDataAccessor } from './utils/data_accessor/appointment_data_accessor';
import { getTargetedAppointment } from './utils/get_targeted_appointment';
Expand All @@ -83,6 +82,7 @@ import { VIEWS } from './utils/options/constants_view';
import type { NormalizedView, SafeSchedulerOptions } from './utils/options/types';
import { getAppointmentGroupValues, setAppointmentGroupValues } from './utils/resource_manager/appointment_groups_utils';
import { ResourceManager } from './utils/resource_manager/resource_manager';
import timeZoneUtils, { type TimezoneLabel } from './utils_time_zone';
import AppointmentLayoutManager from './view_model/appointments_layout_manager';
import { AppointmentDataSource } from './view_model/m_appointment_data_source';
import type { AppointmentViewModelPlain } from './view_model/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { getDeltaTime } from './appointments/resizing/get_delta_time';
import { getDateFormatType, getDateText } from './appointments_new/utils/get_date_text';
import { VERTICAL_VIEW_TYPES } from './constants';
import type Scheduler from './m_scheduler';
import { utils } from './m_utils';
import { isAppointmentTakesAllDay } from './r1/utils/base';
import type {
AppointmentTooltipItem,
CompactAppointmentOptions,
SafeAppointment,
TargetedAppointment,
} from './types';
import { utils } from './utils';
import { AppointmentAdapter } from './utils/appointment_adapter/appointment_adapter';
import type { AppointmentItemViewModel } from './view_model/types';

Expand Down
42 changes: 0 additions & 42 deletions packages/devextreme/js/__internal/scheduler/m_utils.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import timeZoneUtils from '../../m_utils_time_zone';
import timeZoneUtils from '../../utils_time_zone';
import { TimeZoneCalculator } from './calculator';

export const createTimeZoneCalculator = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import { describe, expect, it } from '@jest/globals';

import timeZoneUtils from '../../m_utils_time_zone';
import timeZoneUtils from '../../utils_time_zone';
import { calculateRows } from './agenda';

const createDate = (year: number, month: number, day: number, hours: number) => {
const dateUTC = timeZoneUtils.createUTCDateWithLocalOffset(
const date = timeZoneUtils.createUTCDateWithLocalOffset(
new Date(year, month, day, hours),
).getTime();
return dateUTC;
) as Date;
return date.getTime();
};

describe('calculateRows', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import { describe, expect, it } from '@jest/globals';

import timeZoneUtils from '../../m_utils_time_zone';
import timeZoneUtils from '../../utils_time_zone';
import { calculateRows } from './agenda';

const createDate = (year: number, month: number, day: number, hours: number) => {
const dateUTC = timeZoneUtils.createUTCDateWithLocalOffset(
const date = timeZoneUtils.createUTCDateWithLocalOffset(
new Date(year, month, day, hours),
).getTime();
return dateUTC;
) as Date;
return date.getTime();
};

describe('calculateRows', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import timeZoneUtils from '../../m_utils_time_zone';
import timeZoneUtils from '../../utils_time_zone';
import type { ListEntity } from '../../view_model/types';
import { setOptionHour } from './base';

Expand Down Expand Up @@ -49,7 +49,8 @@ export const calculateRows = (

for (let i = 0; i < agendaDuration; i += 1) {
const date = getDateByIndex(startViewDate, i);
const dayStart = getDayStart(timeZoneUtils.createUTCDateWithLocalOffset(date));
const utcDate = timeZoneUtils.createUTCDateWithLocalOffset(date);
const dayStart = getDayStart(utcDate as Date);
intervalsStartMap.set(dayStart, i);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { VERTICAL_GROUP_COUNT_CLASSES } from '../../classes';
import {
HORIZONTAL_GROUP_ORIENTATION, VERTICAL_GROUP_ORIENTATION,
} from '../../constants';
import timeZoneUtils from '../../m_utils_time_zone';
import type {
AllDayPanelModeType,
AppointmentGeometry,
Expand All @@ -24,6 +23,7 @@ import type {
import type { ResourceLoader } from '../../utils/loader/resource_loader';
import type { ResourceId } from '../../utils/loader/types';
import { VIEWS } from '../../utils/options/constants_view';
import timeZoneUtils from '../../utils_time_zone';

const toMs = dateUtils.dateToMilliseconds;
const DAY_HOURS = 24;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dateUtilsTs } from '@ts/core/utils/date';
import { RRule, RRuleSet } from 'rrule';

import timeZoneUtils from '../m_utils_time_zone';
import timeZoneUtils from '../utils_time_zone';
import { getDateByAsciiString, parseRecurrenceRule } from './base';
import type { ProcessorOptions, RRuleParams } from './types';
import { validateRRuleObject } from './validate_rule';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Widget from '@js/ui/widget/ui.widget';
import { extend } from '@ts/core/utils/m_extend';

import timeZoneUtils from './m_utils_time_zone';
import {
DEFAULT_SCHEDULER_INTEGRATION_OPTIONS,
DEFAULT_SCHEDULER_INTERNAL_OPTIONS,
Expand All @@ -15,6 +14,7 @@ import type {
} from './utils/options/types';
import { getCurrentView, getViewOption, getViews } from './utils/options/utils';
import { SchedulerOptionsValidator, SchedulerOptionsValidatorErrorsHandler } from './utils/options_validator/index';
import timeZoneUtils from './utils_time_zone';

export class SchedulerOptionsBaseWidget extends Widget<SafeSchedulerOptions> {
protected views: NormalizedView[] = [];
Expand Down
56 changes: 56 additions & 0 deletions packages/devextreme/js/__internal/scheduler/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { getPublicElement } from '@js/core/element';
import type { dxElementWrapper } from '@js/core/renderer';
import $ from '@js/core/renderer';
import { getOuterHeight, setHeight, setWidth } from '@js/core/utils/size';

import { APPOINTMENT_SETTINGS_KEY } from './constants';
import type { AppointmentViewModelPlain } from './view_model/types';

export const utils = {
dataAccessors: {
getAppointmentSettings: (
element: dxElementWrapper,
): AppointmentViewModelPlain | undefined => $(element)
.data(APPOINTMENT_SETTINGS_KEY) as unknown as AppointmentViewModelPlain | undefined,
Comment thread
bit-byte0 marked this conversation as resolved.
Comment thread
bit-byte0 marked this conversation as resolved.
},
DOM: {
getHeaderHeight: (header: unknown): number => {
const h = header as Record<string, unknown> | null | undefined;
return h?._$element
? parseInt(getOuterHeight(h._$element as dxElementWrapper), 10)
: 0;
},
},
renovation: {
renderComponent: (
widget: unknown,
parentElement: dxElementWrapper,
componentClass: unknown,
componentName: string,
viewModel: Record<string, unknown>,
): void => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const w = widget as any;
let component = w[componentName];
if (!component) {
const container = getPublicElement(parentElement);
component = w._createComponent(container, componentClass, viewModel);
w[componentName] = component;
} else {
const $element = component.$element() as dxElementWrapper;
const elementStyle = ($element.get(0) as HTMLElement).style;
const { height } = elementStyle;
const { width } = elementStyle;

component.option(viewModel);

if (height) {
setHeight($element, height);
}
if (width) {
setWidth($element, width);
}
}
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
describe, expect, it,
} from '@jest/globals';

import timeZoneUtils from './m_utils_time_zone';
import timeZoneUtils from './utils_time_zone';

describe('isLocalTimeMidnightDST', () => {
it('should return false for summer DST', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
import { macroTaskArray } from '@ts/scheduler/utils/index';

import { globalCache } from './global_cache';
import timeZoneUtils from './m_utils_time_zone';
import timeZoneList from './timezones/timezone_list';
import timeZoneUtils from './utils_time_zone';

const defaultTimeZones = timeZoneList.value;

Expand Down
Loading
Loading