Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
bd7eec67
Commit
bd7eec67
authored
Jan 25, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复日期禁用不准确的问题
parent
3c3f685c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
10 deletions
+3
-10
index.tsx
src/components/RangeTime/index.tsx
+3
-10
No files found.
src/components/RangeTime/index.tsx
View file @
bd7eec67
...
...
@@ -66,21 +66,14 @@ const RangeTime: React.FC<Iprops> = (props: Iprops) => {
};
const
getDisableDate
=
useCallback
((
current
:
Moment
,
mode
:
"startTime"
|
"endTime"
)
=>
{
const
reverseMode
=
mode
===
'startTime'
?
'endTime'
:
'startTime'
;
const
modeTime
:
Moment
|
null
=
innerRangeTime
[
reverseMode
];
const
{
startTime
,
endTime
}
=
innerRangeTime
;
// current 为当前日历上的日期, 如果返回值为true,那么表示当前日期为禁用状态
if
(
!
modeTime
)
{
if
(
shouldGtCurrent
)
{
return
current
<
currentDay
.
endOf
(
endOfUnit
);
}
return
false
;
}
if
(
mode
===
'startTime'
)
{
return
shouldGtCurrent
?
(
current
<
currentDay
.
endOf
(
endOfUnit
)
||
current
>
(
modeTime
as
Moment
).
endOf
(
endOfUnit
))
:
current
>
(
modeTime
as
Moment
).
endOf
(
endOfUnit
)
;
return
shouldGtCurrent
?
current
<=
endTime
||
current
<=
currentDay
:
false
;
}
else
{
//现在的时间要大于开始的时间, true 为禁用
return
shouldGtCurrent
?
(
current
<
currentDay
.
endOf
(
endOfUnit
)
||
current
<
(
modeTime
as
Moment
).
endOf
(
endOfUnit
))
:
current
<
(
modeTime
as
Moment
).
endOf
(
endOfUnit
)
;
return
shouldGtCurrent
?
current
<
startTime
||
current
<=
currentDay
:
false
;
}
},
[
innerRangeTime
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment