Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
ebd6f2ff
Commit
ebd6f2ff
authored
Mar 01, 2018
by
ddcat1115
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Countdown error format and invalid initial time, close #1009
parent
cb88864b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
src/components/CountDown/index.js
src/components/CountDown/index.js
+5
-7
No files found.
src/components/CountDown/index.js
View file @
ebd6f2ff
...
...
@@ -51,9 +51,8 @@ class CountDown extends Component {
}
lastTime
=
targetTime
-
new
Date
().
getTime
();
return
{
lastTime
,
lastTime
:
lastTime
<
0
?
0
:
lastTime
,
};
}
// defaultFormat = time => (
...
...
@@ -63,11 +62,11 @@ class CountDown extends Component {
const
hours
=
60
*
60
*
1000
;
const
minutes
=
60
*
1000
;
const
h
=
fixedZero
(
Math
.
floor
(
time
/
hours
)
);
const
m
=
fixedZero
(
Math
.
floor
((
time
-
(
h
*
hours
))
/
minutes
)
);
const
s
=
fixedZero
(
Math
.
floor
((
time
-
(
h
*
hours
)
-
(
m
*
minutes
))
/
1000
)
);
const
h
=
Math
.
floor
(
time
/
hours
);
const
m
=
Math
.
floor
((
time
-
(
h
*
hours
))
/
minutes
);
const
s
=
Math
.
floor
((
time
-
(
h
*
hours
)
-
(
m
*
minutes
))
/
1000
);
return
(
<
span
>
{
h
}:{
m
}:{
s
}
<
/span
>
<
span
>
{
fixedZero
(
h
)}:{
fixedZero
(
m
)}:{
fixedZero
(
s
)
}
<
/span
>
);
}
tick
=
()
=>
{
...
...
@@ -98,7 +97,6 @@ class CountDown extends Component {
render
()
{
const
{
format
=
this
.
defaultFormat
,
onEnd
,
...
rest
}
=
this
.
props
;
const
{
lastTime
}
=
this
.
state
;
const
result
=
format
(
lastTime
);
return
(
<
span
{...
rest
}
>
{
result
}
<
/span>
)
;
...
...
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