Skip to content

Add AddHours and AddDays date filters - #124

Merged
NickJosevski merged 1 commit into
masterfrom
nj/date-filters
Aug 10, 2026
Merged

Add AddHours and AddDays date filters#124
NickJosevski merged 1 commit into
masterfrom
nj/date-filters

Conversation

@NickJosevski

@NickJosevski NickJosevski commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Related PRs

Merge order: this PR first, then the package publishes, then Docs and Server. Calamari additionally needs its Octostache 3.9.2 pin bumped, so it stays red until then.

Repo PR
Docs OctopusDeploy/docs#3326
Server OctopusDeploy/OctopusDeploy#46148
Calamari OctopusDeploy/Calamari#2124

Why

Raised private: ticket.

That company drives ServiceNow change requests entirely from Octopus variables and need a change window of start + 2 hours. Deploy fromOctopus UI want to keep doing it this way.

What

Two new date filters, AddHours and AddDays:

#{Octopus.Task.QueueTime | AddHours 2 | Format "yyyy-MM-dd HH:mm:ss"}
  • Amounts can be negative (AddHours -2). Can also do quoted: (AddHours "1.5")
  • Unusable input (non-date, non-numeric amount, wrong argument count) returns null, so the token echoes unreplaced rather than silently producing a wrong date.

Time zone handling

Input shape Behaviour
No offset (2030-05-22 09:05:00, Octopus.Task.QueueTime) Stays naive
UTC (…Z, from NowDateUtc) Stays UTC
Explicit offset (…+02:00) Keeps +02:00, not converted to server-local

Tests

Additive change unlikely to impact anything

🤖 Generated with Claude Code

Shift a date by hours or days, output in round-trip format so the result
can be chained into Format. Amounts can be negative, or quoted for
fractions.

Time zone shape is preserved: naive stays naive, UTC stays UTC, and an
explicit offset is kept rather than converted to server-local.

Raised from ticket 215987 — deriving a ServiceNow change window of
start + 2 hours, from the Octopus UI, with no CLI or script step in the
path to compute it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@zentron zentron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from adding a few other keywords :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants