Otter
Snippets
Otter
Upstream Otter 1.0.1 Tested
Add Days to Calculate Due Date
Add or advance calendar days on a date instance to calculate deadlines.
Architecture & Runtime Preview
Otter 1.0.1Zero-dependency Otter 1.0.1 snippet (Dates & Times). Copy the parameterized template or run the self-contained example.
- 1Category: Dates & Times
- 2Attribution: Otter Core Language Spec (D96)
- 3Zero external pack dependencies — paste directly into any .ot file
Source Code (2 files)
targetDate is date from "${initialDate}"
add ${numDays} days to targetDate
invoiceDate is date from "2026-03-01"
add 30 days to invoiceDate
say "Invoice due date:" invoiceDate
expectedDate is date from "2026-03-31"
if invoiceDate is not expectedDate
fail with "date addition mismatch: expected 2026-03-31"
.
Installation & Usage
otter snippet inspect date-add-days
Copy template.ot directly into your .ot source file, or run example.ot with 'otter run example.ot'.