如何根据react-native中的开始日期和结束日期从API获取数据列表?
list('b'.values())
答案 0 :(得分:0)
componentDidMount = async() => {
start = 0;
var today = new Date();
today.setHours(0,0,0,0);
var day = today.getDay() - start;
var date = today.getDate() - day;
var Start = new Date(today.setDate(date));
var End= new Date(today.setDate(date + 6));
var StartDate = new Date(Start);
var EndDate = new Date(End);
var startingDate = StartDate.getDate()+"-"+(new Date(Start).getMonth()+1)+"-
"+ new Date(Start).getFullYear();
var endingDate = EndDate.getDate()+"-"+(new Date(End).getMonth()+1)+"-"+ new
Date(End).getFullYear();
var token = await AsyncStorage.getItem('accesToken')
var response await = this.props.posthistory({'startDate':startingDate,'endDate':endingDate,'page':'1'},accesstoken)
if(!response.error){
this.setState({response})
}
}