How to calculate a duration (the time between start/end times)?

First, let’s define a function called time_to_duration and test it:

jq 'def time_to_duration: strptime("%H:%M")|[2021]+.[1:]|mktime;
time_to_duration' <<< '"01:00"'

Now let’s create another function that will invoke that first function:

jq -c 'def time_to_duration: strptime("%H:%M")|[2021]+.[1:]|mktime;
def duration: (.[1]|time_to_duration)-(.[0]|time_to_duration)|strftime("%H:%M");
duration' <<< '["01:00", "01:45"]'