⏱️
Read a Duration
clock.durationThe ClocktowerTimeReads a length of time someone typed — 90s, 10m, 1h30m, 2 days, 1:30 — and gives you numbers to work with: {{duration.seconds}}, {{duration.minutes}}, words like “1 hour and 30 minutes”, and {{duration.at}}, the moment it lands if it started now. Invalid means it wasn't a length of time.
When to use this
- →Months and years aren't a fixed length, so they're Invalid — use days or weeks
On the canvas
This is what Read a Duration looks like when you place it on your flow. Each field below is something you configure in the inspector panel.
⏱️Time
Read a Duration
clock.durationtextrequired
e.g. {{input.options.duration}}
unit
select…
asrequired
duration
valid
invalid
Config fields
| Field | Type | Req | What it does |
|---|---|---|---|
texte.g. {{input.options.duration}} | text | yes | Read this ⏱️ |
unit | select | — | A plain number means… ⏱️ |
asduration | text | yes | Save it as ✨ |
Sparks this piece adds
After this piece runs, these values are available as sparks in every node downstream.
{{duration.ms}}numberThe length in milliseconds{{duration.seconds}}numberThe length in seconds{{duration.minutes}}numberThe length in minutes{{duration.text}}stringIn words: 1 hour and 30 minutes{{duration.short}}stringShort: 1h 30m{{duration.at}}numberWhen it lands if it started now, as a Unix time{{duration.relative}}stringA live Discord countdown to thatOutput ports
valid{{duration.text}} reads it back in words
invalidThat wasn't a length of time — ask again
📐
In TypeScript, this would be…
Not something you need to write — just a look at what Kitcord does for you.
TypeScript
const ms = parseDuration("1h30m"); // 5_400_000, or null → Huh? ✗
const minutes = Math.round(ms / 60_000); // {{duration.minutes}} = 90
const at = Math.floor((Date.now() + ms) / 1000); // {{duration.at}}