saeedrahimi / antd-jalali

A wrapper for ant-design date picker and calendar to support Jalali calendar type
https://saeedrahimi.github.io/antd-jalali/
85 stars 37 forks source link

feat: Fix compatibility with new antd v5.14.0 DatePicker refactors #43

Closed amir2mi closed 5 months ago

amir2mi commented 9 months ago

This pull request includes updating package antd version to 5.14.2, which fix compatibility issues with newly refactored <DatePicker /> component as mentioned here: ant-design/ant-design#46982

As I installed antd version 5.14.2, antd-jalali stopped working and this error was thrown:

Compiled with problems:

ERROR in src/jalali/generateJalaliConfig.ts:52:7

TS2739: Type '{ getNow: () => Dayjs; getFixedDate: (string: string) => Dayjs; getEndDate: (date: Dayjs) => Dayjs; getWeekDay: (date: Dayjs) => number; getYear: (date: Dayjs) => number; ... 16 more ...; locale: { ...; }; }' is missing the following properties from type 'GenerateConfig<Dayjs>': getMillisecond, setMillisecond
    50 | };
    51 |
  > 52 | const generateJalaliConfig: GenerateConfig<Dayjs> = {
       |       ^^^^^^^^^^^^^^^^^^^^
    53 |   // get
    54 |   getNow: () => dayjs(),
    55 |   getFixedDate: (string) => dayjs(string, "YYYY-MM-DD"),

I fixed it by defining the getMillisecond and setMillisecond in generateJalaliConfig, (src/jalali/generateJalaliConfig.ts).

saeedrahimi commented 5 months ago

Thanks for your contribution, I just updated the repository, I assume this issue will be also resolved with the latest changes. Please feel free to reopen this PR. 🙂