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
Action | Purpose |
---|---|
- | - |
Targets
Target | Purpose | Default |
---|---|---|
- | - | - |
Classes
Class | Purpose | Default |
---|---|---|
- | - | - |
Values
Value | Type | Description | Default |
---|---|---|---|
timestamp | String | The UNIX timestamp in seconds of the date/time to show "time elapsed" for | - |
minutes (Optional) | Number | Whether or not to show minutes in the outputted string | true |
seconds (Optional) | Number | Whether or not to show seconds in the outputted string | true |
Events
Event | When | Dispatched on | event.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.