Add seconds, minutes, hours days, months, or years to a selected date or current date and format the output
A Yaak template function plugin that allows you to add or subtract time from the current date/time and format the output.
Due to Yaak plugin API limitations, ALL 7 fields must be filled in:
0 if you don’t want to add/subtract years0 if you don’t want to add/subtract months0 if you don’t want to add/subtract days0 if you don’t want to add/subtract hours0 if you don’t want to add/subtract minutes0 if you don’t want to add/subtract secondsYYYY-MM-DD HH:mm:ssYou cannot leave fields blank - Yaak will show “Missing required argument” errors. You must type something in each field (use 0 for time adjustments you don’t need).
🕒 Always uses current date/time - The plugin always starts from the current date/time. A base date/time parameter is not currently supported due to Yaak plugin API limitations.
npm install -g @yaakapp/cli
mkdir yaak-plugin-dateadd
cd yaak-plugin-dateadd
Copy the plugin files (package.json, tsconfig.json, and src/index.ts) to this directory
Install dependencies:
npm install
npm run build
For active development, use the dev command to watch for changes:
npm run dev
Once installed, you can use the dateAdd template function in your Yaak requests.
${[ dateAdd() ]} in your request0YYYY-MM-DD HH:mm:ssCurrent date/time with standard format:
${[ dateAdd('0', '0', '0', '0', '0', '0', 'YYYY-MM-DD HH:mm:ss') ]}
Result: 2025-03-20 14:30:45
7 days from now:
${[ dateAdd('0', '0', '7', '0', '0', '0', 'YYYY-MM-DD') ]}
Result: 2025-03-27
3 hours and 30 minutes from now:
${[ dateAdd('0', '0', '0', '3', '30', '0', 'YYYY-MM-DD HH:mm:ss') ]}
Result: 2025-03-20 18:00:45
1 year, 2 months, 15 days from now:
${[ dateAdd('1', '2', '15', '0', '0', '0', 'YYYY-MM-DD') ]}
Result: 2026-06-04
Go back 7 days (negative values work):
${[ dateAdd('0', '0', '-7', '0', '0', '0', 'YYYY-MM-DD') ]}
Result: 2025-03-13
Complex calculation:
${[ dateAdd('1', '2', '15', '3', '30', '45', 'YYYY-MM-DD HH:mm:ss') ]}
Adds 1 year, 2 months, 15 days, 3 hours, 30 minutes, and 45 seconds from now.
The plugin supports the following format tokens:
| Token | Description | Example |
|---|---|---|
YYYY |
4-digit year | 2025 |
YY |
2-digit year | 25 |
MMMM |
Full month name | January |
MMM |
Short month name | Jan |
MM |
2-digit month | 01 |
M |
Month number | 1 |
DD |
2-digit day | 05 |
D |
Day number | 5 |
dddd |
Full day name | Monday |
ddd |
Short day name | Mon |
dd |
Min day name | Mo |
d |
Day of week (0-6) | 1 |
HH |
24-hour (2-digit) | 13 |
H |
24-hour | 13 |
hh |
12-hour (2-digit) | 01 |
h |
12-hour | 1 |
mm |
2-digit minutes | 05 |
m |
Minutes | 5 |
ss |
2-digit seconds | 09 |
s |
Seconds | 9 |
SSS |
Milliseconds | 123 |
A |
AM/PM uppercase | PM |
a |
am/pm lowercase | pm |
Z |
Timezone offset | +01:00 |
ZZ |
Timezone offset (no colon) | +0100 |
X |
Unix timestamp (seconds) | 1735000000 |
x |
Unix timestamp (milliseconds) | 1735000000000 |
| Format | Example Output |
|---|---|
YYYY-MM-DD |
2025-01-15 |
DD/MM/YYYY |
15/01/2025 |
MM/DD/YYYY |
01/15/2025 |
MMMM D, YYYY |
January 15, 2025 |
dddd, MMMM D, YYYY |
Wednesday, January 15, 2025 |
YYYY-MM-DD HH:mm:ss |
2025-01-15 14:30:45 |
DD MMM YYYY HH:mm |
15 Jan 2025 14:30 |
YYYY-MM-DDTHH:mm:ssZ |
2025-01-15T14:30:45+01:00 |
X |
1735000000 (Unix timestamp) |
{
"Authorization": "Bearer token",
"Expires": "${[ dateAdd('', 0, 0, 7, 0, 0, 0, 'YYYY-MM-DDTHH:mm:ssZ') ]}"
}
GET /api/reports?start_date=${[ dateAdd('', 0, 0, -30) ]}&end_date=${[ dateAdd() ]}
{
"appointment_date": "${[ dateAdd('', 0, 0, 14, 9, 0, 0, 'YYYY-MM-DDTHH:mm:ss') ]}",
"follow_up_date": "${[ dateAdd('', 0, 0, 44, 9, 0, 0, 'YYYY-MM-DDTHH:mm:ss') ]}"
}
{
"token": "abc123",
"expires_at": "${[ dateAdd('', 0, 0, 0, 1, 0, 0, 'X') ]}"
}
{
"scheduled_time": "${[ dateAdd('2025-10-22T14:00:00', 0, 0, 0, 0, 30, 0, 'YYYY-MM-DDTHH:mm:ssZ') ]}"
}
yaak-plugin-dateadd/
├── src/
│ └── index.ts # Plugin source code
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
└── README.md # This file
npm run build
npm run dev
This plugin is inspired by the DateAdd plugin for Insomnia by SebBrookfield. It provides enhanced functionality for Yaak users:
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
For issues or questions: