The block accepts:
initialDuration
[string] – ISO 8601 durationpauseDuration
[string][optional] – ISO 8601 durationtargetDateTime
[string][optional] – ISO 8601 date and timeFor example:
"PT42M24S"
corresponds to 42 minutes and 24 seconds in ISO 8601 duration format"2022-01-31T12:00:00.000Z"
means January 31st, 2022 at 12:00:00 PM UTC in ISO 8601 date and time formatDetailed format descriptions can be found at https://en.wikipedia.org/wiki/ISO_8601.
The only required property is the initial timer duration (initialDuration
).
It needs to be between 1 second ("PT1S"
) and 99 minutes 59 seconds ("PT99M59S"
).
When Play button is pressed, the block calls updateEntities()
and sets targetDateTime
to current time + initialDuration
.
This triggers the timer.
Pressing Pause button unsets targetDateTime
but sets pauseDuration
to continue from.
When the timer reaches 00:00, targetDateTime
is not unset to avoid duplicate entity updates if the timer is rendered in multiple places.
If the value of targetDateTime
points to the past, it is interpreted as undefined.
Invalid property values are auto-corrected to prevent runtime errors.
Repository