"x hours ago" value with scripting


I’m planning to change my “last modified” information with something more usable. Concrete example: I have a security screen with door sensors and motion sensors. With each sensor, I have a label next to it providing “last modified” value of the variable. This comes from Homeseer as HSLastChange attribute. Unfortunately, when presented on the screen it looks something like “DD.MM.YYYY HH:MM” which is not very easily to read quickly if you have many sensors.

Any ideas in the forum how I could create a script to present this in more readable way? Ideally I would like to build something similar to social media sites with “2h ago” etc. The logic itself is probably easy/trivial to do, but moreover I cannot see an easy way how I could use/invoke this type of script to update labels when respective data values change. Of course I could create new variables and scripting on Homeseer side, but my gut feeling says this should be solved on the app side.

As a feature suggestion that came to my mind: there could be something like formatting function that could be defined (as property) for labels etc. This would be just a standard javascript function that would take the actual label value as input and use the function logic to create the output shown on the screen for the user. A bit similar to Excel formatting that allows user to see a modified representation of the actual value. Not sure if this makes sense though, or there is some other way to do this already.

Thanks for any thoughs!

Kind regards,

This is a feature that could probably be added.