2023-01-10 05:06:12 -08:00
|
|
|
import { Expression, INodeExecutionData, Workflow } from '../../src';
|
|
|
|
import * as Helpers from '../Helpers';
|
|
|
|
|
|
|
|
export const nodeTypes = Helpers.NodeTypes();
|
|
|
|
export const workflow = new Workflow({
|
|
|
|
nodes: [
|
|
|
|
{
|
|
|
|
name: 'node',
|
|
|
|
typeVersion: 1,
|
|
|
|
type: 'test.set',
|
|
|
|
id: 'uuid-1234',
|
|
|
|
position: [0, 0],
|
|
|
|
parameters: {},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
connections: {},
|
|
|
|
active: false,
|
|
|
|
nodeTypes,
|
|
|
|
});
|
|
|
|
export const expression = new Expression(workflow);
|
|
|
|
|
|
|
|
export const evaluate = (value: string, values?: INodeExecutionData[]) =>
|
|
|
|
expression.getParameterValue(
|
|
|
|
value,
|
|
|
|
null,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
'node',
|
|
|
|
values ?? [],
|
|
|
|
'manual',
|
|
|
|
'America/New_York',
|
|
|
|
{},
|
|
|
|
);
|
2023-01-12 07:06:34 -08:00
|
|
|
|
|
|
|
export const getLocalISOString = (date: Date) => {
|
|
|
|
const offset = date.getTimezoneOffset();
|
|
|
|
const offsetAbs = Math.abs(offset);
|
|
|
|
const isoString = new Date(date.getTime() - offset * 60 * 1000).toISOString();
|
|
|
|
const hours = String(Math.floor(offsetAbs / 60)).padStart(2, '0');
|
|
|
|
const minutes = String(offsetAbs % 60).padStart(2, '0');
|
|
|
|
return `${isoString.slice(0, -1)}${offset > 0 ? '-' : '+'}${hours}:${minutes}`;
|
|
|
|
};
|