From cc0f8def2336b0c524cfbbe1037dbf165625e57c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=81=82=E6=B5=B7=E9=94=8B?= Date: Sun, 22 May 2022 17:53:37 +0800 Subject: [PATCH] docs: fix rlt change range value error --- docs/examples/rtl.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/examples/rtl.tsx b/docs/examples/rtl.tsx index 7077128fb..2fc307538 100644 --- a/docs/examples/rtl.tsx +++ b/docs/examples/rtl.tsx @@ -9,7 +9,7 @@ import enUS from '../../src/locale/en_US'; import jaJP from '../../src/locale/ja_JP'; import '../../assets/index.less'; -const defaultValue = moment('2019-11-28 01:02:03'); +const defaultValue = moment(); function formatDate(date: Moment | null) { return date ? date.format('YYYY-MM-DD HH:mm:ss') : 'null'; @@ -25,8 +25,9 @@ export default () => { }; const onChange = (newValue: Moment | null, formatString?: string) => { - console.log('Change:', newValue, formatString); - setValue(newValue); + const lastValue = Array.isArray(newValue) ? newValue[1] : newValue; + console.log('Change:', lastValue, newValue, formatString); + setValue(lastValue); }; const sharedProps = { @@ -206,7 +207,7 @@ export default () => { locale={zhCN} allowClear ref={rangePickerRef} - defaultValue={[moment('1990-09-03'), moment('1989-11-28')]} + defaultValue={[moment(), moment().add(1, 'M')]} placeholder={['start...', 'end...']} />