If I have a time range
{"start_time":"8:30", "end_time":"18:00"}
, and I want to subtract another time range like {"start_time":"12:30", "end_time":"14:00"}
, the result would be: [{"start_time":"8:30", "end_time":"12:30"},{"start_time":"14:00", "end_time":"18:00"}]
Additionally, if I need to subtract more time ranges sequentially e.g.
[{"start_time":"8:30", "end_time":"12:30"},{"start_time":"14:00", "end_time":"18:00"}]
- {"start_time":"16:30", "end_time":"17:00"}
, the expected output should be [{"start_time":"8:30", "end_time":"12:30"},{"start_time":"14:00", "end_time":"16:30"},{"start_time":"17:00", "end_time":"18:00"}]
I am looking for the most effective logical approach to achieve this. Any suggestions?
Thank you