calendar merge date
calendar merge date
componentDidMount () {
const {
monthDays,
// monthDates,
} = this.props;
const defaultMonthDays = [...new Uint8Array(monthDays)];
// default days
const dateDays = defaultMonthDays.map((item, i) => i+1).map((item, i) => ({
day: item,
visible: true,
selected: false,
disabled: false,
}));
const monthDates = [
{
"id": 210404,
"start": 1617532218562,
"end": 1617532218562,
"lowPrice": 127.00,
"status": 0,
"priceLowest": false,
"hasTicket": true,
"availableNumbers": [
1,
2,
3,
4,
5,
6
],
day: 12,
},
];
// merge dates
monthDates.forEach(
(obj, i) => {
const {
day,
} = obj;
dateDays.forEach((item, j) => {
if(item.day === day) {
dateDays[j] = {
...item,
...obj,
};
}
})
}
)
log(`merged dateDays`, dateDays);
this.setState({
dateDays,
})
}
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/12669398.html
未经授权禁止转载,违者必究!