Toggle navigation
Toggle navigation
This project
Loading...
Sign in
mobile
/
YH_RNComponent
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈林
6 years ago
Commit
8be75e923d6420fb289ffc977012e54c0f2fe7d8
1 parent
3f71414b
修改秒杀列表计算时间天数不正确的问题。review by 孙凯。
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
js/seckill/reducers/seckill/seckillActions.js
js/seckill/reducers/seckill/seckillActions.js
View file @
8be75e9
...
...
@@ -448,7 +448,7 @@ function parseActivityTimeLsit(json, focusTime=0) {
}
}
let
now
=
Date
.
now
();
let
now
=
new
Date
();
newActivityTimeList
.
forEach
((
activityTimeItem
,
i
)
=>
{
let
date
,
...
...
@@ -466,9 +466,7 @@ function parseActivityTimeLsit(json, focusTime=0) {
activityTimeItem
.
specialState
=
0
;
let
startDays
=
Math
.
floor
(
now
/
1000
/
60
/
60
/
24
);
let
endDate
=
Math
.
floor
(
activityTimeItem
.
startTime
/
1000
/
60
/
60
/
24
);
let
offsetDate
=
endDate
-
startDays
;
let
offsetDate
=
getDiffDays
(
date
,
now2
);
activityTimeItem
.
specialState
=
offsetDate
<
0
?
0
:
offsetDate
;
...
...
@@ -516,3 +514,14 @@ function parseActivityTimeLsit(json, focusTime=0) {
};
}
//date1 减去 date2 相差的天数
function
getDiffDays
(
date1
,
date2
){
let
nDate1
=
new
Date
();
nDate1
=
new
Date
(
date1
.
getFullYear
(),
date1
.
getMonth
(),
date1
.
getDate
());
let
newDate2
=
new
Date
(
date2
);
newDate2
=
new
Date
(
date2
.
getFullYear
(),
date2
.
getMonth
(),
date2
.
getDate
());
let
diffDays
=
(
nDate1
-
newDate2
)
/
1000
/
60
/
60
/
24
;
return
diffDays
;
}
...
...
Please
register
or
login
to post a comment