n8n-io/n8n · warning

INVALID_DATE_METHOD

INVALID_DATE_METHOD

Error message

'${node.name}' parameter "${path}" uses .toISOString() which is a JS Date method. Use .toISO() for Luxon DateTime ($now, $today).

What it means

Warning-level validator issue (code INVALID_DATE_METHOD) emitted when a parameter value string contains '.toISOString()', which is a JavaScript Date method. n8n's $now and $today are Luxon DateTime objects, whose equivalent method is .toISO(). Using the JS method will fail at evaluation time, so the validator flags it preemptively.

Solutions

  1. Replace .toISOString() with .toISO() for any Luxon DateTime ($now, $today).
  2. Verify the result format matches expectations (ISO string).
  3. Re-run validation to confirm the issue clears.

Example fix

// before
'={{ $now.toISOString() }}'
// after
'={{ $now.toISO() }}'
Defensive patterns

Strategy: validation

Validate before calling

/\.toISOString\(\)/.test(String(paramValue))
  // warn: Luxon DateTime ($now/$today) should use .toISO()

Prevention

When it happens

Trigger: Writing an expression like '={{ $now.toISOString() }}' or '={{ $today.toISOString() }}' in any node parameter.

Common situations: Copying JS Date code into an expression; LLM-generated workflow that assumes native Date; muscle memory from non-Luxon environments.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/9090dc1ab23b288b. Report an issue: GitHub.

Appendix: source

Thrown at packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/date-method-validator.ts:38

	priority: 30,

	validateNode(
		node: NodeInstance<string, string, unknown>,
		_graphNode: GraphNode,
		_ctx: PluginContext,
	): ValidationIssue[] {
		const issues: ValidationIssue[] = [];

		const params = node.config?.parameters;
		if (!params) {
			return issues;
		}

		const dateIssues = findInvalidDateMethods(params);

		for (const { path } of dateIssues) {
			issues.push({
				code: 'INVALID_DATE_METHOD',
				message: `'${node.name}' parameter "${path}" uses .toISOString() which is a JS Date method. Use .toISO() for Luxon DateTime ($now, $today).`,
				severity: 'warning',
				nodeName: node.name,
				parameterPath: path,
			});
		}

		return issues;
	},
};

View on GitHub (pinned to 5ac6606e81)