Authored by 张文文

Merge branch 'V1130_Date' of http://git.yoho.cn/mobile/YH_RNComponent into group_v1130

@@ -475,6 +475,7 @@ const ScrollView = createReactClass({ @@ -475,6 +475,7 @@ const ScrollView = createReactClass({
475 pull to refresh 475 pull to refresh
476 */ 476 */
477 enablePullToRefresh: PropTypes.bool, 477 enablePullToRefresh: PropTypes.bool,
  478 + enableUFOPullToRefresh: PropTypes.bool,
478 isOnPullToRefresh: PropTypes.bool, 479 isOnPullToRefresh: PropTypes.bool,
479 onRefreshData: PropTypes.func, 480 onRefreshData: PropTypes.func,
480 onFinishRefreshData: PropTypes.func, 481 onFinishRefreshData: PropTypes.func,
@@ -333,6 +333,7 @@ const ScrollView = React.createClass({ @@ -333,6 +333,7 @@ const ScrollView = React.createClass({
333 pull to refresh 333 pull to refresh
334 */ 334 */
335 enablePullToRefresh: PropTypes.bool, 335 enablePullToRefresh: PropTypes.bool,
  336 + enableUFOPullToRefresh: PropTypes.bool,
336 isOnPullToRefresh: PropTypes.bool, 337 isOnPullToRefresh: PropTypes.bool,
337 onRefreshData: PropTypes.func, 338 onRefreshData: PropTypes.func,
338 onFinishRefreshData: PropTypes.func, 339 onFinishRefreshData: PropTypes.func,
@@ -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 +