From c0e7620036738f8d0b382d0d0610b981dcbc29e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 27 Aug 2024 16:45:08 +0200 Subject: [PATCH] fix(Wait Node): Prevent waiting until invalid date (#10523) --- packages/nodes-base/nodes/Wait/Wait.node.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Wait/Wait.node.ts b/packages/nodes-base/nodes/Wait/Wait.node.ts index 98badea833..10bbb01871 100644 --- a/packages/nodes-base/nodes/Wait/Wait.node.ts +++ b/packages/nodes-base/nodes/Wait/Wait.node.ts @@ -7,7 +7,7 @@ import type { IDisplayOptions, IWebhookFunctions, } from 'n8n-workflow'; -import { WAIT_TIME_UNLIMITED } from 'n8n-workflow'; +import { WAIT_TIME_UNLIMITED, NodeOperationError } from 'n8n-workflow'; import { authenticationProperty, @@ -346,6 +346,7 @@ export class Wait extends Webhook { }, default: '', description: 'The date and time to wait for before continuing', + required: true, }, // ---------------------------------- @@ -492,6 +493,13 @@ export class Wait extends Webhook { } else { const dateTimeStr = context.getNodeParameter('dateTime', 0) as string; + if (isNaN(Date.parse(dateTimeStr))) { + throw new NodeOperationError( + context.getNode(), + '[Wait node] Cannot put execution to wait because `dateTime` parameter is not a valid date. Please pick a specific date and time to wait until.', + ); + } + waitTill = DateTime.fromFormat(dateTimeStr, "yyyy-MM-dd'T'HH:mm:ss", { zone: context.getTimezone(), })