mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix(Wait Node): Prevent waiting until invalid date (#10523)
This commit is contained in:
parent
fd58a272e1
commit
c0e7620036
|
@ -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(),
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue