File tree Expand file tree Collapse file tree 3 files changed +24
-24
lines changed
rn/components/calendar/common
src/components/calendar/common Expand file tree Collapse file tree 3 files changed +24
-24
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,14 @@ export function handleActive(
21
21
const dayjsStart = start ? dayjs ( start ) : dayjsEnd
22
22
23
23
item . isSelected =
24
- _value . isSame ( dayjsEnd ) ||
25
- _value . isSame ( dayjsStart ) ||
26
- ( _value . isAfter ( dayjsStart ) && _value . isBefore ( dayjsEnd ) )
24
+ _value ? .isSame ( dayjsEnd ) ||
25
+ _value ? .isSame ( dayjsStart ) ||
26
+ ( _value ? .isAfter ( dayjsStart ) && _value ? .isBefore ( dayjsEnd ) )
27
27
28
- item . isSelectedHead = _value . isSame ( dayjsStart )
29
- item . isSelectedTail = _value . isSame ( dayjsEnd )
28
+ item . isSelectedHead = _value ? .isSame ( dayjsStart )
29
+ item . isSelectedTail = _value ? .isSame ( dayjsEnd )
30
30
31
- item . isToday = _value . diff ( dayjs ( Date . now ( ) ) . startOf ( 'day' ) , 'day' ) === 0
31
+ item . isToday = _value ? .diff ( dayjs ( Date . now ( ) ) . startOf ( 'day' ) , 'day' ) === 0
32
32
33
33
return item
34
34
}
@@ -94,8 +94,8 @@ export function handleDisabled(
94
94
const dayjsMaxDate = dayjs ( maxDate )
95
95
96
96
item . isDisabled =
97
- ! ! ( minDate && _value . isBefore ( dayjsMinDate ) ) ||
98
- ! ! ( maxDate && _value . isAfter ( dayjsMaxDate ) )
97
+ ! ! ( minDate && _value ? .isBefore ( dayjsMinDate ) ) ||
98
+ ! ! ( maxDate && _value ? .isAfter ( dayjsMaxDate ) )
99
99
100
100
return item
101
101
}
Original file line number Diff line number Diff line change @@ -21,14 +21,14 @@ export function handleActive(
21
21
const dayjsStart = start ? dayjs ( start ) : dayjsEnd
22
22
23
23
item . isSelected =
24
- _value . isSame ( dayjsEnd ) ||
25
- _value . isSame ( dayjsStart ) ||
26
- ( _value . isAfter ( dayjsStart ) && _value . isBefore ( dayjsEnd ) )
24
+ _value ? .isSame ( dayjsEnd ) ||
25
+ _value ? .isSame ( dayjsStart ) ||
26
+ ( _value ? .isAfter ( dayjsStart ) && _value ? .isBefore ( dayjsEnd ) )
27
27
28
- item . isSelectedHead = _value . isSame ( dayjsStart )
29
- item . isSelectedTail = _value . isSame ( dayjsEnd )
28
+ item . isSelectedHead = _value ? .isSame ( dayjsStart )
29
+ item . isSelectedTail = _value ? .isSame ( dayjsEnd )
30
30
31
- item . isToday = _value . diff ( dayjs ( Date . now ( ) ) . startOf ( 'day' ) , 'day' ) === 0
31
+ item . isToday = _value ? .diff ( dayjs ( Date . now ( ) ) . startOf ( 'day' ) , 'day' ) === 0
32
32
33
33
return item
34
34
}
@@ -94,8 +94,8 @@ export function handleDisabled(
94
94
const dayjsMaxDate = dayjs ( maxDate )
95
95
96
96
item . isDisabled =
97
- ! ! ( minDate && _value . isBefore ( dayjsMinDate ) ) ||
98
- ! ! ( maxDate && _value . isAfter ( dayjsMaxDate ) )
97
+ ! ! ( minDate && _value ? .isBefore ( dayjsMinDate ) ) ||
98
+ ! ! ( maxDate && _value ? .isAfter ( dayjsMaxDate ) )
99
99
100
100
return item
101
101
}
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ declare namespace Calendar {
21
21
export interface Item {
22
22
value : string
23
23
24
- _value : dayjs . Dayjs
24
+ _value ? : dayjs . Dayjs
25
25
26
26
text : number
27
27
@@ -46,6 +46,12 @@ declare namespace Calendar {
46
46
isSelectedTail ?: boolean
47
47
}
48
48
49
+ export interface SelectedDate {
50
+ end ?: Calendar . DateArg
51
+
52
+ start : Calendar . DateArg
53
+ }
54
+
49
55
export interface GroupOptions {
50
56
validDates : Array < ValidDate >
51
57
@@ -67,12 +73,6 @@ declare namespace Calendar {
67
73
68
74
list : List < T >
69
75
}
70
-
71
- export interface SelectedDate {
72
- end ?: Calendar . DateArg
73
-
74
- start : Calendar . DateArg
75
- }
76
76
}
77
77
78
78
export default Calendar
@@ -181,7 +181,7 @@ export interface AtCalendarControllerProps {
181
181
onSelectDate : ( e : BaseEvent ) => void
182
182
}
183
183
184
- export interface AtCalendarControllerState { }
184
+ export interface AtCalendarControllerState { }
185
185
// #endregion
186
186
187
187
// #region AtCalendarBody
You can’t perform that action at this time.
0 commit comments