mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
fix(Wait Node): Account for workflow timezone in Wait node datetime (#8578)
Co-authored-by: Omar Ajoue <krynble@gmail.com>
This commit is contained in:
parent
a2a3ca160f
commit
1116a28b45
|
@ -151,7 +151,6 @@ import Container from 'typedi';
|
|||
import type { BinaryData } from './BinaryData/types';
|
||||
import merge from 'lodash/merge';
|
||||
import { InstanceSettings } from './InstanceSettings';
|
||||
import { toUtcDate } from './utils';
|
||||
|
||||
axios.defaults.timeout = 300000;
|
||||
// Prevent axios from adding x-form-www-urlencoded headers by default
|
||||
|
@ -3560,7 +3559,7 @@ export function getExecuteFunctions(
|
|||
binaryToBuffer: async (body: Buffer | Readable) =>
|
||||
await Container.get(BinaryDataService).toBuffer(body),
|
||||
async putExecutionToWait(waitTill: Date): Promise<void> {
|
||||
runExecutionData.waitTill = toUtcDate(waitTill, getTimezone(workflow));
|
||||
runExecutionData.waitTill = waitTill;
|
||||
if (additionalData.setExecutionStatus) {
|
||||
additionalData.setExecutionStatus('waiting');
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { DateTime } from 'luxon';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
|
@ -29,7 +30,6 @@ import {
|
|||
} from '../Form/common.descriptions';
|
||||
import { formWebhook } from '../Form/utils';
|
||||
import { updateDisplayOptions } from '../../utils/utilities';
|
||||
|
||||
import { Webhook } from '../Webhook/Webhook.node';
|
||||
|
||||
const waitTimeProperties: INodeProperties[] = [
|
||||
|
@ -420,12 +420,17 @@ export class Wait extends Webhook {
|
|||
|
||||
waitAmount *= 1000;
|
||||
|
||||
// Timezone does not change relative dates, since they are just
|
||||
// a number of seconds added to the current timestamp
|
||||
waitTill = new Date(new Date().getTime() + waitAmount);
|
||||
} else {
|
||||
// resume: dateTime
|
||||
const dateTime = context.getNodeParameter('dateTime', 0) as string;
|
||||
const dateTimeStr = context.getNodeParameter('dateTime', 0) as string;
|
||||
|
||||
waitTill = new Date(dateTime);
|
||||
waitTill = DateTime.fromFormat(dateTimeStr, "yyyy-MM-dd'T'HH:mm:ss", {
|
||||
zone: context.getTimezone(),
|
||||
})
|
||||
.toUTC()
|
||||
.toJSDate();
|
||||
}
|
||||
|
||||
const waitValue = Math.max(waitTill.getTime() - new Date().getTime(), 0);
|
||||
|
|
Loading…
Reference in a new issue