|
@@ -448,7 +448,7 @@ function parseActivityTimeLsit(json, focusTime=0) { |
|
@@ -448,7 +448,7 @@ function parseActivityTimeLsit(json, focusTime=0) { |
448
|
}
|
448
|
}
|
449
|
}
|
449
|
}
|
450
|
|
450
|
|
451
|
- let now = Date.now();
|
451
|
+ let now = new Date();
|
452
|
|
452
|
|
453
|
newActivityTimeList.forEach((activityTimeItem, i) => {
|
453
|
newActivityTimeList.forEach((activityTimeItem, i) => {
|
454
|
let date,
|
454
|
let date,
|
|
@@ -466,13 +466,9 @@ function parseActivityTimeLsit(json, focusTime=0) { |
|
@@ -466,13 +466,9 @@ function parseActivityTimeLsit(json, focusTime=0) { |
466
|
|
466
|
|
467
|
activityTimeItem.specialState = 0;
|
467
|
activityTimeItem.specialState = 0;
|
468
|
|
468
|
|
469
|
- let startDays = Math.floor(now / 1000 / 60 / 60 / 24);
|
|
|
470
|
- let endDate = Math.floor(activityTimeItem.startTime / 1000 / 60 / 60 / 24);
|
|
|
471
|
- let offsetDate = endDate - startDays;
|
469
|
+ let offsetDate = getDiffDays(date, now);
|
472
|
activityTimeItem.specialState = offsetDate < 0 ? 0 : offsetDate;
|
470
|
activityTimeItem.specialState = offsetDate < 0 ? 0 : offsetDate;
|
473
|
|
471
|
|
474
|
-
|
|
|
475
|
-
|
|
|
476
|
if (currentTime > activityTimeItem.startTime) {
|
472
|
if (currentTime > activityTimeItem.startTime) {
|
477
|
|
473
|
|
478
|
if(currentTime > activityTimeItem.endTime){
|
474
|
if(currentTime > activityTimeItem.endTime){
|
|
@@ -516,3 +512,14 @@ function parseActivityTimeLsit(json, focusTime=0) { |
|
@@ -516,3 +512,14 @@ function parseActivityTimeLsit(json, focusTime=0) { |
516
|
};
|
512
|
};
|
517
|
|
513
|
|
518
|
}
|
514
|
}
|
|
|
515
|
+
|
|
|
516
|
+//date1 减去 date2 相差的天数
|
|
|
517
|
+function getDiffDays(date1, date2){
|
|
|
518
|
+ let nDate1 = new Date();
|
|
|
519
|
+ nDate1 = new Date(date1.getFullYear(),date1.getMonth(),date1.getDate());
|
|
|
520
|
+ let newDate2 = new Date(date2);
|
|
|
521
|
+ newDate2 =new Date(date2.getFullYear(),date2.getMonth(),date2.getDate());
|
|
|
522
|
+ let diffDays = (nDate1 - newDate2) / 1000 / 60 / 60 / 24;
|
|
|
523
|
+ return diffDays;
|
|
|
524
|
+ }
|
|
|
525
|
+ |