Scheduler: refactor core files (TS) - Part 2#33846
Conversation
There was a problem hiding this comment.
Pull request overview
This PR continues the Scheduler TS refactor by renaming internal utility modules (m_utils* → utils*), updating import paths across Scheduler core/view model/workspace code and tests, and tightening TypeScript typings to support stricter TS/ESLint settings.
Changes:
- Renamed/replaced core Scheduler utilities (
m_utils.ts→utils.ts) and updated imports in Scheduler/workspaces/subscribes/scheduler. - Renamed/replaced timezone utilities (
m_utils_time_zone→utils_time_zone) and updated imports in Scheduler code and test suites. - Refactored
utils_time_zone.tsfor stricter typing and rule compliance (typed params/returns, reordered helpers, added null-safety handling in some consumers/tests).
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/timezones.tests.js | Update timezone utils import path to renamed module. |
| packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.appointmentsVertical.tests.js | Update timezone utils import path to renamed module. |
| packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/dataSource.tests.js | Update timezone utils import path to renamed module. |
| packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.methods.tests.js | Update timezone utils import path to renamed module. |
| packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_provider.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_timeline_month.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator_month.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_grouped_data_map_provider.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_date_header_data_generator.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts | Switch scheduler core utils import from m_utils to new utils. |
| packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_month.ts | Switch scheduler core utils import from m_utils to new utils. |
| packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_indicator.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/workspaces/m_timeline.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/view_model/get_appointment_info.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/steps/virtual_screen_filter.ts | Switch timezone utils import and add casts for nullable return typing. |
| packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/options/get_minutes_cell_intervals.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/view_model/filtration/utils/split_by_recurrence/get_date_information.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/view_model/common/get_compare_options.ts | Switch timezone utils import and add casts for nullable return typing. |
| packages/devextreme/js/__internal/scheduler/utils.ts | New typed replacement for m_utils.ts (DOM/data accessors + renovation rendering helper). |
| packages/devextreme/js/__internal/scheduler/utils_time_zone.ts | Renamed/refactored timezone utilities with typed params/returns and reordered helpers. |
| packages/devextreme/js/__internal/scheduler/utils_time_zone.test.ts | Update timezone utils import path to renamed module. |
| packages/devextreme/js/__internal/scheduler/utils_time_zone.santiago.test.ts | Update timezone utils import path to renamed module. |
| packages/devextreme/js/__internal/scheduler/scheduler_options_base_widget.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/recurrence/generate_dates.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/r1/utils/base.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/r1/utils/agenda.ts | Switch timezone utils import and add cast for nullable return typing. |
| packages/devextreme/js/__internal/scheduler/r1/utils/agenda.santiago.test.ts | Switch timezone utils import and add null-safety fallback in helper. |
| packages/devextreme/js/__internal/scheduler/r1/utils/agenda.pacific.test.ts | Switch timezone utils import and add null-safety fallback in helper. |
| packages/devextreme/js/__internal/scheduler/r1/timezone_calculator/utils.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/m_utils.ts | Removed old Scheduler utils module (replaced by utils.ts). |
| packages/devextreme/js/__internal/scheduler/m_subscribes.ts | Switch scheduler core utils import from m_utils to new utils. |
| packages/devextreme/js/__internal/scheduler/m_scheduler.ts | Switch imports from m_utils/m_utils_time_zone to utils/utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/appointments/m_appointment_collection.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/appointment_popup/form.ts | Switch timezone utils import to utils_time_zone. |
| packages/devextreme/js/__internal/scheduler/tests/performance.test.ts | Update timezone utils import path to renamed module. |
Comments suppressed due to low confidence (3)
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:42
createUTCDateWithLocalOffsetnow returnsDate | null | undefined, which forces many downstream casts even when callers pass a definiteDate. Consider using overloads soDateinput producesDateoutput while preservingnull/undefinedpassthrough for nullable inputs.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:236- Line break/indentation in this calculation is inconsistent with surrounding style and easy to misread. Keeping the whole expression on one line avoids lint/formatting churn.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:265 - The line break between the method call and
* MS_IN_MINUTEis hard to read and may not match formatter expectations. Prefer a single-line expression here.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:29
- After renaming
m_utils_time_zonetoutils_time_zone, there is still a consumer importing the removed module (packages/devextreme/js/common/core/environment/time_zone_utils.jsimports../../../__internal/scheduler/m_utils_time_zone). This will cause a runtime/module-resolution failure unless that import is updated or a compatibility re-export is kept.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:33 createUTCDateWithLocalOffsetalways returns aDatewhen the input is aDate, but the currentDate | null | undefinedreturn type forces widespreadas Datecasts in callers. Consider using overloads so the return type is inferred from the input (Date-in → Date-out, null/undefined-in → null/undefined-out).
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:236- Line break in the
timezoneOffsetcalculation makes the/ MINUTES_IN_HOURpart easy to miss and is inconsistent with the surrounding style; keeping this expression on one line also avoids potential indentation/spacing lint issues.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:265 getClientTimezoneOffsetcurrently splits the multiplication onto a new unindented line, which is hard to read and may violate whitespace/indent lint rules. Keep the multiplication on the same line.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 37 out of 37 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:33
createUTCDateWithLocalOffsetnow returnsDate | null | undefinedfor all inputs, which forces downstream call sites (that pass a definiteDate) to addas Datecasts. Consider using overloads so calls with aDatereturn aDate, while still safely passing throughnull/undefined.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:236- The line break/indentation in the
timezoneOffsetcalculation is likely to violateoperator-linebreak/formatting rules and hurts readability. Wrap the expression in parentheses and keep the operator on the same line as the division.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:265 getClientTimezoneOffsetis split across two lines with the*operator starting the next line, which is easy to miss and can trigger lint rules. Prefer a single-line expression (or parentheses) here.
4f72b39 to
c0332ac
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 37 out of 37 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:33
createUTCDateWithLocalOffsetis typed as returningDate | null | undefined, which forces downstream callers to add unsafe casts likeas Datejust to call.getTime(). Prefer TS overloads so callers passing aDateget aDateback, while still allowingnull/undefinedinputs to flow through unchanged.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:265- The line break in
getClientTimezoneOffsetleaves the* MS_IN_MINUTEcontinuation unindented, which is likely to violate the project's formatting/ESLint rules. Keeping the expression on one line (or indenting the continuation) avoids lint failures.
f06c806 to
fa080dd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 37 out of 37 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:265
- The line break before the
*operator ingetClientTimezoneOffsetmakes the expression harder to read and may trip stylistic lint rules. Keeping the multiplication on the same line (or wrapping the expression) avoids that.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:236 - The division operator is split onto its own line when computing
timezoneOffset, which hurts readability and can be flagged by stylistic linting. Keep the full expression on one line (or wrap it in parentheses) to make the intent clear.
packages/devextreme/js/__internal/scheduler/utils_time_zone.ts:42 createUTCDateWithLocalOffsetis typed to returnDate | null | undefinedeven when a non-nullDateis passed, which forces downstreamas Datecasts. If you want to reduce these casts, consider switching this helper to an overloaded function so callers passing aDateget aDatereturn type automatically, while still preserving the nullable passthrough signature.
What
rename
m_utils.tsandm_utils_time_zone.tsto enable strict TS/ESLint rules, type all function paramsHow
type ~15 untyped params/returns, reorder declarations for
no-use-before-define, fixno-param-reassign, addnull-safetycasts in consumer files, update ~30 import paths