Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const constant = x => () => x;
- const times = (n, iterator) => {
- let accum = Array(Math.max(0, n));
- for (let i = 0; i < n; i++) accum[i] = iterator.call();
- return accum;
- };
- let result = [];
- const currentMonth = props.focus.month();
- let iterator = moment(props.focus);
- let i = 0;
- let h = 0;
- let control=[]
- while (iterator.month() === currentMonth) {
- if (iterator.weekday() === 0 || result.length === 0) {
- result.push(times(7, constant({})));
- }
- let week = result[result.length - 1];
- week[iterator.weekday()] = {
- date: iterator.date(),
- dotkoy: iterator.format('DD-MM-YYYY') == props.activity[0] || iterator.format('DD-MM-YYYY') == props.activity[2],
- selected: props.selected && iterator.isSame(props.selected, 'day'),
- today: iterator.isSame(moment(), 'day'),
- haftasonumu: iterator.format('ddd') == "Cts" || iterator.format('ddd') == "Paz",
- };
- iterator.add(1, 'day');
- }
- return result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement