Skip to content

Replace Moment.js with Day.js #1236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Memoraike
Copy link

Fixes #865

* Switch from moment to dayjs for date/time handling
* Update type definitions from Moment to Dayjs
* Update locale configuration
* Remove moment.js dependency
* Update SQL date import to use dayjs
* Update vanilla date/time components to use dayjs
* Clean up imports
* Migrate from moment to dayjs in date/time pickers
* Update Button.Group to Space.Compact
* Restructure widget folders for better organization
* Clean up imports and types
* Update Bootstrap DateTime component
* Update Fluent UI date/time components
* Convert moment method calls to dayjs equivalents
…k#865)

* Switch from @date-io/moment to @date-io/dayjs adapter
* Update MUI providers to use AdapterDayjs
* Update Material and MUI date/time pickers
* Update package dependencies
* Replace moment dependencies with dayjs
* Update webpack configuration for dayjs locales
* Update locale settings in demo configs
* Remove moment-locales-webpack-plugin
to correctly handle immutability of date objects (Replace deprecated Moment.js (potentially with Day.js) ukrbublik#865
Copy link

codesandbox bot commented Apr 10, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

vercel bot commented Apr 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-awesome-query-builder-examples ❌ Failed (Inspect) Apr 11, 2025 0:00am
react-awesome-query-builder-sandbox ❌ Failed (Inspect) Apr 11, 2025 0:00am
react-awesome-query-builder-sandbox-next ❌ Failed (Inspect) Apr 11, 2025 0:00am

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 52be970:

Sandbox Source
@react-awesome-query-builder/examples Configuration
@react-awesome-query-builder/sandbox Configuration
@react-awesome-query-builder/sandbox-simple Configuration
@react-awesome-query-builder/sandbox-next Configuration

@ukrbublik ukrbublik requested a review from Copilot May 16, 2025 14:24
Copy link

@Copilot 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 pull request replaces all references to Moment.js with Day.js, ensuring a lighter-weight dependency while maintaining date and time functionalities.

  • Updated all utility modules and widget components to use Day.js
  • Adjusted configuration and documentation to reflect the new Day.js usage
  • Removed deprecated Moment.js-specific modules from the Ant Design widgets

Reviewed Changes

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

Show a summary per file
File Description
packages/core/modules/utils/index.js Replaced moment export with dayjs
packages/core/modules/utils/configExtend.js Updated imports and usage to reflect Day.js
packages/core/modules/import/jsonLogic.js Updated date formatting functions to use Day.js
packages/core/modules/config/index.js Modified widget functions to utilize Day.js for formatting
packages/core/modules/config/default.js Changed locale settings from moment to dayjs
packages/core/modules/config/ctx.js Replaced moment with dayjs in configuration
packages/bootstrap/modules/widgets/value/BootstrapDateTime.jsx Updated date/time formatting and usage from moment to dayjs
packages/antd/modules/widgets/value/Time.jsx Replaced moment usage with dayjs in time widget handling
packages/antd/modules/widgets/value/DateTime.jsx Updated date/time handling to use dayjs
packages/antd/modules/widgets/value/Date.jsx Replaced moment-based value conversion functions with dayjs
packages/antd/modules/widgets/moment/* Removed Moment.js-specific widget files
packages/antd/modules/widgets/dayjs/* Introduced new widget files to support Day.js usage
CONFIG.adoc Updated configuration documentation from moment to dayjs
Comments suppressed due to low confidence (3)

packages/antd/modules/widgets/moment/index.tsx:1

  • [nitpick] Confirm that removing Moment.js-specific widget exports does not break backward compatibility for any dependent modules.
export { default as DatePicker } from "./DatePicker";

CONFIG.adoc:306

  • [nitpick] Verify that the documentation references and links are updated to correctly point to Day.js resources instead of Moment.js.
locale.dayjs: 'ru',

packages/core/modules/config/index.js:878

  • Ensure that Day.js is configured with the necessary plugins (e.g., for ISO 8601 parsing and locale support) as its default behavior can differ from Moment.js.
const dateVal = this.utils.dayjs(val, wgtDef.valueFormat);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace deprecated Moment.js (potentially with Day.js)
1 participant