Skip to main content

DurationController

Purpose

A controller that displays the distance in numbers between the specified time and the current time. Works for past dates. Similar to TimeDistance controller, but outputs fully qualified numbers for the duration rather than trying to construct a sentence.

Implemented using https://date-fns.org/v2.21.1/docs/formatDuration.

Fire and forget. The only configuration this controller takes is the timestamp, and whether to show seconds/minutes.

Actions

ActionPurpose
--

Targets

TargetPurposeDefault
---

Classes

ClassPurposeDefault
---

Values

ValueTypeDescriptionDefault
timestampStringThe UNIX timestamp in seconds of the date/time to show "time elapsed" for-
minutes (Optional)NumberWhether or not to show minutes in the outputted stringtrue
seconds (Optional)NumberWhether or not to show seconds in the outputted stringtrue

Events

EventWhenDispatched onevent.detail
----

Side Effects

The controller will intelligently set a setTimeout according to the fastest unit of time shown. If minutes/seconds are hidden, then the controller will update less frequently.

All timeouts are cleaned up when the controller disconnects.

How to Use