// 获取当前日期前30天的日期数组
get_30_day = () => {
var thrityMonth = [];
for (var i = 0; i < 30; i++) {
thrityMonth.unshift(new Date(new Date().setDate(new Date().getDate() - i)).toLocaleDateString())
}
console.log('thrityMonth====>', thrityMonth)
}
// 获取当前日期前30天的日期数组 只取每一天的当月第几天,例如2020-11-27 中的27
get_30_day = () => {
var thrityDay = [];
for (var i = 0; i < 30; i++) {
let currDate = new Date(new Date().setDate(new Date().getDate() - i)).toLocaleDateString();
currDate = currDate.includes('/') ? currDate.replaceAll('/', '-') : currDate;
let currDay = currDate.split('-')[currDate.split('-').length - 1];
thrityDay.unshift({ date: currDay, score: i });
}
this.setState({ dataList: thrityDay });
console.log('LDate====>', thrityDay)
}