{"record":{"id":"9090dc1ab23b288b","repo":"n8n-io/n8n","slug":"invalid-date-method","errorCode":"INVALID_DATE_METHOD","errorMessage":"'${node.name}' parameter \"${path}\" uses .toISOString() which is a JS Date method. Use .toISO() for Luxon DateTime ($now, $today).","messagePattern":"'(.+?)' parameter \"(.+?)\" uses \\.toISOString\\(\\) which is a JS Date method\\. Use \\.toISO\\(\\) for Luxon DateTime \\(\\$now, \\$today\\)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/date-method-validator.ts","lineNumber":38,"sourceCode":"\tpriority: 30,\n\n\tvalidateNode(\n\t\tnode: NodeInstance<string, string, unknown>,\n\t\t_graphNode: GraphNode,\n\t\t_ctx: PluginContext,\n\t): ValidationIssue[] {\n\t\tconst issues: ValidationIssue[] = [];\n\n\t\tconst params = node.config?.parameters;\n\t\tif (!params) {\n\t\t\treturn issues;\n\t\t}\n\n\t\tconst dateIssues = findInvalidDateMethods(params);\n\n\t\tfor (const { path } of dateIssues) {\n\t\t\tissues.push({\n\t\t\t\tcode: 'INVALID_DATE_METHOD',\n\t\t\t\tmessage: `'${node.name}' parameter \"${path}\" uses .toISOString() which is a JS Date method. Use .toISO() for Luxon DateTime ($now, $today).`,\n\t\t\t\tseverity: 'warning',\n\t\t\t\tnodeName: node.name,\n\t\t\t\tparameterPath: path,\n\t\t\t});\n\t\t}\n\n\t\treturn issues;\n\t},\n};\n","sourceCodeStart":20,"sourceCodeEnd":49,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/date-method-validator.ts#L20-L49","documentation":"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.","triggerScenarios":"Writing an expression like '={{ $now.toISOString() }}' or '={{ $today.toISOString() }}' in any node parameter.","commonSituations":"Copying JS Date code into an expression; LLM-generated workflow that assumes native Date; muscle memory from non-Luxon environments.","solutions":["Replace .toISOString() with .toISO() for any Luxon DateTime ($now, $today).","Verify the result format matches expectations (ISO string).","Re-run validation to confirm the issue clears."],"exampleFix":"// before\n'={{ $now.toISOString() }}'\n// after\n'={{ $now.toISO() }}'","handlingStrategy":"validation","validationCode":"/\\.toISOString\\(\\)/.test(String(paramValue))\n  // warn: Luxon DateTime ($now/$today) should use .toISO()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember $now and $today are Luxon DateTime, not JS Date.","Use .toISO() for ISO strings, .toMillis() for epoch, .plus()/.minus() for arithmetic.","Search expressions for '.toISOString' before exporting."],"tags":["date","luxon","expression","validator"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}