Calculate time between sun down and 00:00 in decimal value

Maybe you can use a part of my script. I use the api for getting the total minutes of daylight. But when you have the time for Sunrise or Sunset you can calculate the minutes till 0:00.
Solar panels prognose with daylight minutes

This is the api call:

url = (‘'+latitude +’&lng=‘+longitude +’&date=’ + currentYear + ‘-’ + currentMonth + ‘-’ +count +‘&formatted=0’);

Just take a look at the website sunrise sunset
Website Sunrise Sunset