Date & Time
Manipulates date and time values, offering formatting, calculations, and current time generation.
Gets the current time, formats a date, adds time to a date or computes the difference between two dates with Luxon, and adds the value as result to the incoming payload.
This utility does not rely on external services and uses the 'luxon' library for robust handling of timezones and formats.
Operations:
- Now: Returns the current date/time in the specified timezone.
- Format: Converts a date string into a specific format pattern.
- Add: Adds time (minutes, days, etc.) to a given date.
- Diff: Calculates the difference between two dates in a specific unit.
Use Cases:
- Generating timestamps for DB records.
- Calculating "Due Date" (Now + 7 Days).
- Formatting dates for email templates (e.g., "Jan 01, 2024").
How it works
- Resolves the config with these defaults:
operationnow,formatISO,amount0,unithours,timezoneUTC. now: the current time intimezone, as ISO 8601.format: parsesvalueas ISO 8601, converts it totimezoneand returns ISO 8601, or the Luxon pattern informat(for exampleyyyy-MM-dd HH:mm).add: parsesvalue, converts it totimezone, addsamount(converted to a number, negative allowed) inunitand returns ISO 8601.formatis not applied.diff: returnsvalueminusto_value(default now) inunitas a number that can have decimals; positive whenvalueis later.timezoneis not used.- Returns the incoming payload plus
resultthroughout, and repeats the value inmeta.result.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-due-date",
"label": "Compute due date",
"operator_slug": "data.datetime",
"operator_version": "1.0.0",
"config": {
"operation": "add",
"value": "{{ $json.created_at }}",
"amount": 3,
"unit": "days",
"timezone": "America/Bogota"
}
}{
"ok": true,
"data": {
"order_id": "ord_123",
"created_at": "2026-11-26T15:00:00.000Z",
"result": "2026-11-29T10:00:00.000-05:00"
},
"meta": {
"result": "2026-11-29T10:00:00.000-05:00"
},
"port": "out"
}Configuration
-
operationstring Required -
The date operation to perform.
-
valuestring Optional Accepts expressions -
The source date (ISO string). Required for Format, Add, and Diff.
-
formatstring Optional -
The output format pattern (e.g., `yyyy-MM-dd HH:mm`). standard Luxon tokens.
-
amountinteger Optional -
Number of units to add (can be negative).
-
unitstring Optional -
to_valuestring Optional Accepts expressions -
The second date for "Diff" operations.
-
timezonestring Optional -
Target timezone for the operation.
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
value - Only ISO 8601 strings are parsed (
2026-11-26,2026-11-26T15:00:00Z). Other formats such as26/11/2026or epoch numbers fail. -
timezone - With an unknown zone,
nowreturnsresult: nullthroughoutinstead of failing. -
unit - Passed to Luxon as is, so other Luxon units such as
secondsalso work.
Output ports
out default The operation succeeded. result is a string, or a number for diff.
{
"order_id": "ord_123",
"created_at": "2026-11-26T15:00:00.000Z",
"result": "2026-11-29T10:00:00.000-05:00"
}error A date is invalid or the operation is unknown.
{
"ok": false,
"errors": [
"Datetime Error: Invalid date: 26/11/2026 - unparsable"
],
"port": "error"
}In expressions
What a later node can read from this node's output with $("Date & Time").item.json.<path> (write your node's label instead of Date & Time). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Date & Time").item.json.resultThe resulting date string or calculated difference. | ||
$("Date & Time").item.json.order_id | — | |
$("Date & Time").item.json.created_at | — |
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
Datetime Error: Invalid date: <value> - <reason> | error | format received a value that is not ISO 8601 (reason unparsable) or an unknown timezone (reason unsupported zone). |
Datetime Error: Invalid date: <value> | error | add received an invalid value or timezone. |
Datetime Error: Invalid dates for diff | error | value or to_value is not ISO 8601. |
Datetime Error: Unknown operation: <operation> | error | operation is not now, format, add or diff. |
Input contract
-
valuestring Optional -
to_valuestring Optional
Output contract
-
resultstring | number Optional -
The resulting date string or calculated difference.
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "data.datetime",
"name": "Date & Time",
"category": "data",
"version": "1.0.0",
"description": "Manipulates date and time values, offering formatting, calculations, and current time generation.\n\n This utility does not rely on external services and uses the 'luxon' library for robust handling of timezones and formats.\n\n **Operations:**\n - **Now:** Returns the current date/time in the specified timezone.\n - **Format:** Converts a date string into a specific format pattern.\n - **Add:** Adds time (minutes, days, etc.) to a given date.\n - **Diff:** Calculates the difference between two dates in a specific unit.\n\n **Use Cases:**\n - Generating timestamps for DB records.\n - Calculating \"Due Date\" (Now + 7 Days).\n - Formatting dates for email templates (e.g., \"Jan 01, 2024\").",
"capabilities": [
"utils",
"date",
"time",
"luxon"
],
"config_schema": {
"type": "object",
"properties": {
"operation": {
"type": "string",
"enum": [
"now",
"format",
"add",
"diff"
],
"default": "now",
"title": "Operation",
"description": "The date operation to perform."
},
"value": {
"type": "string",
"title": "Input Date",
"description": "The source date (ISO string). Required for Format, Add, and Diff.",
"format": "expression",
"displayOptions": {
"show": {
"operation": [
"format",
"add",
"diff"
]
}
}
},
"format": {
"type": "string",
"title": "Format Pattern",
"default": "ISO",
"description": "The output format pattern (e.g., `yyyy-MM-dd HH:mm`). standard Luxon tokens.",
"displayOptions": {
"show": {
"operation": [
"format"
]
}
}
},
"amount": {
"type": "integer",
"default": 0,
"title": "Amount to Add",
"description": "Number of units to add (can be negative).",
"displayOptions": {
"show": {
"operation": [
"add"
]
}
}
},
"unit": {
"type": "string",
"enum": [
"minutes",
"hours",
"days",
"weeks",
"months",
"years"
],
"default": "hours",
"title": "Unit",
"displayOptions": {
"show": {
"operation": [
"add",
"diff"
]
}
}
},
"to_value": {
"type": "string",
"title": "Compare Date",
"description": "The second date for \"Diff\" operations.",
"format": "expression",
"displayOptions": {
"show": {
"operation": [
"diff"
]
}
}
},
"timezone": {
"type": "string",
"default": "UTC",
"ui_widget": "timezone_picker",
"title": "Timezone",
"description": "Target timezone for the operation."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
},
"required": [
"operation"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"to_value": {
"type": "string"
}
}
},
"output_contract_schema": {
"type": "object",
"properties": {
"result": {
"type": [
"string",
"number"
],
"description": "The resulting date string or calculated difference."
}
}
},
"ports": [
{
"port_id": "out",
"label": "Output",
"is_default": true,
"description": "Operation successful"
},
{
"port_id": "error",
"label": "Error",
"description": "Invalid date or format"
}
],
"execution_mode": "sync",
"tags": [
"date",
"time",
"utils"
],
"is_stateful": false,
"publisher": {
"identity": "org_link_loom",
"profile": {
"name": "Link Loom",
"verified": true,
"url": "https://me.veripass.com/link-loom",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"operation": {
"type": "string",
"enum": [
"now",
"format",
"add",
"diff"
],
"default": "now",
"title": "Operation",
"description": "The date operation to perform."
},
"value": {
"type": "string",
"title": "Input Date",
"description": "The source date (ISO string). Required for Format, Add, and Diff.",
"format": "expression",
"displayOptions": {
"show": {
"operation": [
"format",
"add",
"diff"
]
}
}
},
"format": {
"type": "string",
"title": "Format Pattern",
"default": "ISO",
"description": "The output format pattern (e.g., `yyyy-MM-dd HH:mm`). standard Luxon tokens.",
"displayOptions": {
"show": {
"operation": [
"format"
]
}
}
},
"amount": {
"type": "integer",
"default": 0,
"title": "Amount to Add",
"description": "Number of units to add (can be negative).",
"displayOptions": {
"show": {
"operation": [
"add"
]
}
}
},
"unit": {
"type": "string",
"enum": [
"minutes",
"hours",
"days",
"weeks",
"months",
"years"
],
"default": "hours",
"title": "Unit",
"displayOptions": {
"show": {
"operation": [
"add",
"diff"
]
}
}
},
"to_value": {
"type": "string",
"title": "Compare Date",
"description": "The second date for \"Diff\" operations.",
"format": "expression",
"displayOptions": {
"show": {
"operation": [
"diff"
]
}
}
},
"timezone": {
"type": "string",
"default": "UTC",
"ui_widget": "timezone_picker",
"title": "Timezone",
"description": "Target timezone for the operation."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
},
"required": [
"operation"
]
}{
"type": "object",
"properties": {
"value": {
"type": "string"
},
"to_value": {
"type": "string"
}
}
}{
"type": "object",
"properties": {
"result": {
"type": [
"string",
"number"
],
"description": "The resulting date string or calculated difference."
}
}
}[
{
"port_id": "out",
"label": "Output",
"is_default": true,
"description": "Operation successful"
},
{
"port_id": "error",
"label": "Error",
"description": "Invalid date or format"
}
]Execution
- Execution
sync- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
utilsdatetimeluxon- Tags
datetimeutils
Notes and limits
- An existing
resultkey in the payload is overwritten. - When the envelope has no
data(ordatais falsy), the engine stores the whole envelope as the node output: onerrorthe next node receives{ ok: false, errors: [...], port: "error" }as its payload.
Reviewed against the orchestrator code · 31e874b · 2026-11-26