Skip to content

Commit 664b8cf

Browse files
committed
chore: fix cal logic
1 parent 11f0acc commit 664b8cf

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

docs/examples/range.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default () => {
5353
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
5454
<div style={{ margin: '0 8px' }}>
5555
<h3>Basic</h3>
56-
<RangePicker<Moment>
56+
{/* <RangePicker<Moment>
5757
{...sharedProps}
5858
value={undefined}
5959
locale={zhCN}
@@ -62,7 +62,7 @@ export default () => {
6262
defaultValue={[moment('1990-09-03'), moment('1989-11-28')]}
6363
clearIcon={<span>X</span>}
6464
suffixIcon={<span>O</span>}
65-
/>
65+
/> */}
6666
<RangePicker<Moment>
6767
{...sharedProps}
6868
locale={zhCN}
@@ -77,7 +77,7 @@ export default () => {
7777
console.log('OK!!!', dates);
7878
}}
7979
/>
80-
<RangePicker<Moment>
80+
{/* <RangePicker<Moment>
8181
{...sharedProps}
8282
value={undefined}
8383
locale={zhCN}
@@ -94,10 +94,10 @@ export default () => {
9494
allowClear
9595
picker="time"
9696
style={{ width: 280 }}
97-
/>
97+
/> */}
9898
</div>
9999

100-
<div style={{ margin: '0 8px' }}>
100+
{/* <div style={{ margin: '0 8px' }}>
101101
<h3>Focus</h3>
102102
<RangePicker<Moment>
103103
{...sharedProps}
@@ -185,7 +185,7 @@ export default () => {
185185
placeholder={['start...', 'end...']}
186186
disabledDate={disabledDate}
187187
/>
188-
</div>
188+
</div> */}
189189
</div>
190190
</div>
191191
);

src/RangePicker.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -894,13 +894,13 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
894894
? arrowRef.current.offsetLeft - arrowLeft
895895
: arrowRef.current.offsetLeft;
896896

897+
const panelWidth = panelDivRef.current.offsetWidth;
898+
const arrowWidth = arrowRef.current.offsetWidth;
899+
897900
if (
898-
panelDivRef.current.offsetWidth !== undefined &&
899-
arrowRef.current.offsetWidth !== undefined &&
900-
arrowLeft >
901-
panelDivRef.current.offsetWidth -
902-
arrowRef.current.offsetWidth -
903-
(direction === 'rtl' ? 0 : arrowMarginLeft)
901+
panelWidth &&
902+
arrowWidth &&
903+
arrowLeft > panelWidth - arrowWidth - (direction === 'rtl' ? 0 : arrowMarginLeft)
904904
) {
905905
panelLeft = arrowLeft;
906906
}

0 commit comments

Comments
 (0)