historicState returns UoM but deltaSince doesn't


I’d like to report a potential issue with using persistence values in rules, which I’m not sure a bug or designed by purpose. I have configured an item that is in Number:Volume type with unit “l”, it keeps track of water usage. I have some rules that calculate the usage per hour/day/month etc.
I noticed that if I use historicState, it returns a QuantityType which makes sense. However if I use deltaSince it only returns a Number.
Is it designed by purpose to strip the UoM for deltaSince or could it be a bug? I have the below 2 workarounds:

  1. Either convert the Number to QuantityType when using deltaSince
  2. Get currentState and minus historicState (which gives a QuantityType)

I’m on OH 4.0.1

This is known, and there is already a PR for it, if it gets accepted: Return units in persistence extension commands by mherwege · Pull Request #3736 · openhab/openhab-core · GitHub.

Great, thanks a lot!