JS 函数返回未更新日期? [关闭]

问题描述 投票:0回答:0

这是我的代码:

function chooseDays(days){
  // dateStart='2019-09-23'
  // dateEnd='2100-01-01'
  if(days=='infinity'){
    
  }
  else if(days=='1'){
    dateStart1=new Date(dateStart);   
    dateEnd1=new Date(dateStart1.getTime()+(1000*3600*24));//adding one full day in milliseconds
    dateStart = dateStart1.toLocaleDateString('en-CA', { year: 'numeric', month: '2-digit', day: '2-digit' });
    dateEnd = dateEnd1.toLocaleDateString('en-CA', { year: 'numeric', month: '2-digit', day: '2-digit' });
    console.log("days==1")
  }
  getTimeSeriesGraph(points[i].number,dateStart,dateEnd);   
}

现在的问题是函数

getTimeSeriesGraph
返回的 dateStart 和 dateEnd 没有从上面的
if else
更新。请帮忙?

javascript asynchronous
© www.soinside.com 2019 - 2024. All rights reserved.