From e2c76ff9fb407bc5d9e35cf1909754f6a43754e2 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 18 Mar 2020 16:59:15 +0800 Subject: [PATCH] :clapper: Add RangePicker demo close #22345 --- components/date-picker/demo/disabled-date.md | 1 + .../date-picker/demo/select-in-range.md | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 components/date-picker/demo/select-in-range.md diff --git a/components/date-picker/demo/disabled-date.md b/components/date-picker/demo/disabled-date.md index ee2cba2d05..8ed87cc727 100644 --- a/components/date-picker/demo/disabled-date.md +++ b/components/date-picker/demo/disabled-date.md @@ -66,6 +66,7 @@ ReactDOM.render(

+ { + const [dates, setDates] = useState([]); + + const disabledDate = current => { + if (!dates || dates.length === 0) { + return false; + } + const tooLate = dates[0] && current.diff(dates[0], 'days') > 7; + const tooEarly = dates[1] && dates[1].diff(current, 'days') > 7; + return tooEarly || tooLate; + }; + + return ( + { + setDates(dates); + }} + onOpenChange={open => { + if (!open) { + setDates([]); + } + }} + /> + ); +}; + +ReactDOM.render(, mountNode); +```