I was using timestamp_custom to display hours and minutes of a fractional time value. The value displayed once the time value exceeded 24 hours was truncated when the hours rolled over at 24 hours.
The solution I have made works but seems inelegant in the extreme. I was hoping there would be a switch in the timestamp object to override the 24 hour rollover but sadly there is not as far as I could find.
The function timestamp_custom takes a timestamp object as an input, which is defined as the number of seconds since Jan 1 1970 (UTC). So when you calculate the difference between two timestamps that are just a few hours apart and display the result with timestamp_custom('%H:%M', false) you are actually feeding that function with an object that represents a few hours after Jan 1 1970 and you’re just omitting the year and month and day in the displayed output.
For example if you send the value 90,000 to the timestamp_custom function, you’re not asking that function to show you how many hours and minutes there are in 90,000 seconds. Instead what you are doing is asking it to show the hours and minutes of “Jan 2 1970 at 1:00am UTC time” which of course is “01:00”.
That’s a long-winded way to say there is no way to disable the 24-hour rollover because that’s not what is actually happening.
Edit:
Here’s some examples with code. Let’s start with a timedelta object, which is what will result when you subtract one datetime object from another datetime object. This is different from the timestamp object. Here’s an example:
{% set td = now() - (today_at("03:00") - timedelta(days=1)) %}
We’ve established that the following is a”hack” and only works for durations less than 24h: