Skip to content

[Bug] Runtime crash in RangeDatePicker - "Cannot read properties of undefined (reading 'en')" #227

@hehmdalool

Description

@hehmdalool

Hello!

First, thank you for the quick fix in issue #223. The build is now successful with Rspack!

However, after updating date-components to the latest version (3.3.1), I've encountered a new runtime error when trying to use the RangeDatePicker component. The page crashes immediately upon rendering the component.

The application crashes with the following error:

TypeError: Cannot read properties of undefined (reading 'en')
    at splitFormatIntoSections (utils.ts:416:1)
    at utils.ts:690:1
    at mountState (react-dom.development.js:16167:1)
    at Object.useState (react-dom.development.js:16880:1)
    at Object.useState (react.development.js:1622:1)
    at useFormatSections (utils.ts:690:1)
    at useRangeDateFieldState (useRangeDateFieldState.ts:61:1)
    at useDatePickerState (datePickerStateFactory.ts:125:1)
    at RangeDatePicker (RangeDatePicker.tsx:29:1)
    at renderWithHooks (react-dom.development.js:15486:1)
Image

Here are the relevant dependencies from my package.json before the problematic update:

{
  "react": "^18.2.0",
  "react-dom": "^18.2.0",
  "@gravity-ui/uikit": "^7.23.0",
  "@gravity-ui/app-builder": "^0.32.1",
  "@gravity-ui/date-components": "^3.3.1",
  "@gravity-ui/date-utils": "^2.5.6"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions