From acfa8c38b7692b69ba632e67c3df81ce92ce7910 Mon Sep 17 00:00:00 2001 From: WmW Date: Tue, 14 Mar 2023 11:01:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(MonthPicker):=20=E6=9B=B4=E6=96=B0=E6=A8=A1?= =?UTF-8?q?=E6=80=81=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=96=87=E6=A1=A3=20&=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=88=E4=BB=BD=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=20bug(#954)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(Modal): 模态对话框文档中没引入组件报错 * fix(MonthPicker): 修复月份选择器,选择下一年时,实际上选择了前一年 --- packages/react-modal/README.md | 2 +- packages/react-month-picker/src/index.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-modal/README.md b/packages/react-modal/README.md index fe143ec49d..92cd853c6a 100644 --- a/packages/react-modal/README.md +++ b/packages/react-modal/README.md @@ -140,7 +140,7 @@ export default Demo; ```jsx mdx:preview&bg=#fff import React from 'react'; -import { Modal, ButtonGroup, Button, Form, Input, Textarea } from 'uiw'; +import { Modal, ButtonGroup, Button, Form, Input, Textarea, Notify, Row, Col } from 'uiw'; class Demo extends React.Component { constructor() { diff --git a/packages/react-month-picker/src/index.tsx b/packages/react-month-picker/src/index.tsx index 33924e2c8c..c985d431b2 100644 --- a/packages/react-month-picker/src/index.tsx +++ b/packages/react-month-picker/src/index.tsx @@ -106,7 +106,9 @@ export default function MonthPicker(props: MonthPickerProps) { setType(captionType); } else { const year = new Date(panelDate).getFullYear(); - const curPanelDate = new Date(new Date(panelDate).setFullYear(type === 'next' ? year + 1 : year - 1)); + const curPanelDate = new Date( + new Date(panelDate).setFullYear(captionType === 'next' ? year + 1 : year - 1), + ); setPanelDate(curPanelDate); } }}