Calculate total price for time-based variable pricing

Generally speaking, how would you calculate the cost of a trip where different quantities of time cost different rates? For example:

  • $.20 per minute to 59 mins;
  • $9.75 per hour to 7.4 hours;
  • $71.50 per “day” (counting 7.5-24 hours)

I’m asking for start and end dates, and calculating the difference. Then I’m trying to compare that to the rates using nested conditionals but I can’t figure out the logic, or mostly actually the expressions for the math. Is there a way to check for remainders to figure out how many minutes are left over after all the hours are used up? Is JavaScript the only answer? All suggestions welcome!