Bug Description
I am trying to do some date/time arithmatic and it shows the correct time in the preview below the field but when it is executed the output is different that what is shown in the field preview. I think its a bug (they should be the same). the node being used its and edit/set node. See the picture below (the two dates that should be the same are underlined in blue in the picture):
To Reproduce
Code to reproduce the issue.
{{ (() => {
const start = new Date($json.body.args.prefered_datetime);
const duration = (parseInt($json.slot_size) || 60) * 60000;
const end = new Date(start.getTime() + duration);
const offset = $json.body.args.prefered_datetime.slice(-6);
const pad = (n) => String(n).padStart(2, '0');
return ${end.getFullYear()}-${pad(end.getMonth() + 1)}-${pad(end.getDate())}T${pad(end.getHours())}:${pad(end.getMinutes())}:${pad(end.getSeconds())}${offset};
})() }}
Expected behavior
Both Dates should be the same, the preview and the output.
Debug Info
Debug info
core
- n8nVersion: 2.31.5
- platform: npm
- nodeJsVersion: 22.22.2
- nodeEnv: undefined
- database: sqlite
- executionMode: regular
- concurrency: -1
- license: enterprise (production)
storage
- success: all
- error: all
- progress: false
- manual: true
- binaryMode: filesystem
pruning
- enabled: true
- maxAge: 336 hours
- maxCount: 10000 executions
client
- userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/150.0.0.0 safari/537.36
- isTouchDevice: false
Generated at: 2026-08-03T18:26:54.827Z
Operating System
Ubuntu 24.04.4 LTS
n8n Version
2.31.5
Node.js Version
22.22.2
Database
SQLite (default)
Execution mode
main (default)
Hosting
self hosted
Bug Description
I am trying to do some date/time arithmatic and it shows the correct time in the preview below the field but when it is executed the output is different that what is shown in the field preview. I think its a bug (they should be the same). the node being used its and edit/set node. See the picture below (the two dates that should be the same are underlined in blue in the picture):
To Reproduce
Code to reproduce the issue.
{{ (() => {
const start = new Date($json.body.args.prefered_datetime);
const duration = (parseInt($json.slot_size) || 60) * 60000;
const end = new Date(start.getTime() + duration);
const offset = $json.body.args.prefered_datetime.slice(-6);
const pad = (n) => String(n).padStart(2, '0');
return
${end.getFullYear()}-${pad(end.getMonth() + 1)}-${pad(end.getDate())}T${pad(end.getHours())}:${pad(end.getMinutes())}:${pad(end.getSeconds())}${offset};})() }}
Expected behavior
Both Dates should be the same, the preview and the output.
Debug Info
Debug info
core
storage
pruning
client
Generated at: 2026-08-03T18:26:54.827Z
Operating System
Ubuntu 24.04.4 LTS
n8n Version
2.31.5
Node.js Version
22.22.2
Database
SQLite (default)
Execution mode
main (default)
Hosting
self hosted