ant-design / ant-design

An enterprise-class UI design language and React UI library
https://ant.design
MIT License
92.74k stars 50.14k forks source link

DatePicker types error using Luxon DateTime #48757

Closed jonmurciano closed 7 months ago

jonmurciano commented 7 months ago

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Insert DateTime with onChange property.

What is expected?

onChange property on DatePicker component returns typinng error not admitting nullable DateTime.

What is actually happening?

onChange property on DatePicker component returns typinng error not admitting nullable DateTime

Environment Info
antd 5.14.0
React react
System Windows 10 Pro 22H2
Browser Google Chrome 124.0.6367.119 (Build oficial) (64 bits)
afc163 commented 7 months ago
图片
github-actions[bot] commented 7 months ago

Hello @jonmurciano. Please provide a online reproduction by forking codesandbox of antd@5.x or antd@4.x, or provide a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 3 days.

你好 @jonmurciano,我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 antd@5.xantd@4.x 的 codesandbox,或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。

什么是最小化重现,为什么这是必需的?

jonmurciano commented 7 months ago

Hello, I've already solved the access to codesandbox.

afc163 commented 7 months ago

How could I reproduce the type error?

图片
pabloimrik17 commented 7 months ago

Hi, we are having some problems trying to import LuxonGenerateConfig from rc-picker in the sandbox.

This is our situtation after 5.14.

We are creating a Datepicker based on Luxon following your guide

https://ant.design/docs/react/use-custom-date-library/

image image

Based on that we create our picker wrapper component, empty as showed below, nothing custom yet image

Now the onChange event in your types is missing | null.

image

onChange type from 5.14

image

before to 5.14

image

afc163 commented 7 months ago

Could you reproduce it in your codesandbox?

pabloimrik17 commented 7 months ago

Sorry guys, after reviewing the error was a little mistake on our side. Closing the issue

Thank for your time