Countdown to next service

Hi Folks,

I’'m wondering if there is a block I could use to visually show the hours to the next service interval for industrial equipment? I was thinking something like a countdown widget or progress bar? Maybe a bar chart?

If you can store the date of the next service interval as a number attribute on a device, and format that number as a Unix timestamp in milliseconds, you could use an Indicator Block to display the next interval either as an absolute date or as a rounded value relative to the current time.

For an absolute date value (i.e. “Jan 1, 2019 at 12:30pm”), use the {{formatDate}} format helper. Pass the result of your query as the first argument, and you can pass in a Moment.js format string as the second argument to display in any format you’d like.

For a relative value (i.e. “in 14 days”), use the {{formatDateRelative}} helper. Again, pass the query result as the first argument, but do not pass a second argument to default to “now”.

You can even use the block’s conditional statements to change the background color or messaging as you approach the service window.

1 Like