I have an array that represents the hours of operation for a store and is stored as:
schedule = [ [[mon_open, 9], [mon_close, 5]],
[[tues_open, 11], [tues_close, 7]],
[[wed_open, 9], [wed_close, 5]],
[[thur_open,9], [thur_close, 5]],
[[fri_open, 11], [fri_close, 7]] ]
In this situation I would like to group the arrays such that in the above example [[mon_open, 9],[mon_close, 5]]
, [[wed_open, 9],[wed_close, 5]]
, and [[thur_open,9],[thur_close, 5]]
would be grouped together...
and similary [[tues_open, 11],[tues_close, 7]]
, and [[fri_open, 11],[fri_close, 7]]
would be grouped together.
Basically I want to group days of the week with the same opening and closing times. Can this be done simply?