I’m creating a form which allow user to key in multiple days of week with multiple operation hours.
I want the format to save as below, but I found it tedious to reformat for displaying using normal javascript. Look into lodash and found it very handy 🙂
[ Â {"day":"Mo","hour":{"from":"10am", "to":"2pm"}}, Â {"day":"Mo","hour":{"from":"3pm", "to":"9pm"}}, Â {"day":"Th","hour":{"from":"10am", "to":"2pm"}}, Â {"day":"Th","hour":{"from":"3pm", "to":"9pm"}}, Â {"day":"We","hour":{"from":"10am", "to":"2pm"}}, Â {"day":"We","hour":{"from":"4pm", "to":"10pm"}}, ];
Format to display:
Mo, Th, We : 10am-2pm Mo, Th : 3pm-9pm We : 4pm-10pm
Plunker here
Reference: schema.org