State History Duration (How much time was that on?)

I was looking through my Home Assistant today at a location history. I noticed it now says “Was at Home” and lists the time the state had changed and how much time has past since that change. I thought, okay well I can see that, for example maybe I was at Home between 1:00pm and 3:30pm. I think it’d be very valuable to have the actual length of time calculated and displayed. For instance “Was at Home (2 hr 30 min)” would be useful. While hovering over the time period in question in the History Graph it would be useful for it to show up here as well. I am including a screenshot with the changes I’m suggesting. Does anyone know how to go about adding this? I would do it myself but I not sure where in the code to find this.

Bump? Does anyone know what files need to be edited to make this change?

Voted. This would be very useful for devices which have a constant power draw but no monitoring, just a switch. With a simple switch I could easily see that my 100W heater has used, say, 1 kWh, but doing the mental maths each time to figure out how many hours between 11:31pm and 9:56am is too much!

Sorry Matthew, I don’t know anything about the frontend so I can’t help with a patch.