K
Docs
API Reference→Pieces→Shift a Time
↔️

Shift a Time

clock.shiftThe ClocktowerTime

Moves a moment later or earlier by a length of time: “3 days from now”, “1 hour before the event”. Leave the time blank for now. You get {{shifted.unix}}, {{shifted.iso}} and {{shifted.discord}}, ready to show or to hand to Do It Later's “At a set time”.

On the canvas

This is what Shift a Time looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

↔️
Shift a Time
clock.shift
Time
time
Now when empty
direction
select…
byrequired
e.g. 1h, 3 days
unit
select…
asrequired
shifted
output
invalid

Config fields

FieldTypeReqWhat it does
time
Now when empty
text—From 📅
directionselect—Which way
by
e.g. 1h, 3 days
textyesBy ⏱️
unitselect—A plain number means… ⏱️
as
shifted
textyesSave it as ✨

Sparks this piece adds

After this piece runs, these values are available as sparks in every node downstream.

{{shifted.unix}}numberThe new moment, as a Unix time
{{shifted.iso}}stringThe new moment, as an ISO date
{{shifted.discord}}stringShown as a date in everyone's own time
{{shifted.relative}}stringA live Discord countdown to it

Output ports

output{{shifted.*}} holds the new moment
invalidThe time or the length didn't make sense
📐

In TypeScript, this would be…

Not something you need to write — just a look at what Kitcord does for you.

TypeScript
const at = Date.now() + 7 * 24 * 3600_000; // 7 days later
const unix = Math.floor(at / 1000); // {{shifted.unix}}
const shown = `<t:${unix}:f>`; // {{shifted.discord}}