I have an array that contains calendardays like this. this array may contain data from all the months.
calendarday: [CalendarDay{2017-8-13}, CalendarDay{2017-8-14}, CalendarDay{2017-9-18}, CalendarDay{2017-9-19}, CalendarDay{2017-10-15}, CalendarDay{2017-10-16}]
I want to split those array values by its months into different arrays or same arrays with different keys. like this
calendarday: [CalendarDay{2017-8-13}, CalendarDay{2017-8-14}]
calendardayone: [CalendarDay{2017-9-18}, CalendarDay{2017-9-19}]
or like this
calendarday: [
0:[CalendarDay{2017-8-13}, CalendarDay{2017-8-14}],
1:[CalendarDay{2017-9-18}, CalendarDay{2017-9-19}],
2:[CalendarDay{2017-10-15}, CalendarDay{2017-10-16}]
]
One way I found is to check if condition for all the month and split those array. But I don't want to do that. Is there any alternative methods so that I will not have to check if condition for all months?