mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
chore: Enfore consistent file-name casing on all backend packages (#15755)
This commit is contained in:
committed by
GitHub
parent
66d339c0d8
commit
3a2a70f193
43
packages/workflow/test/ExpressionExtensions/helpers.ts
Normal file
43
packages/workflow/test/ExpressionExtensions/helpers.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { IDataObject } from '@/interfaces';
|
||||
import { Workflow } from '@/workflow';
|
||||
|
||||
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 = workflow.expression;
|
||||
|
||||
export const evaluate = (value: string, values?: IDataObject[]) =>
|
||||
expression.getParameterValue(
|
||||
value,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
'node',
|
||||
values?.map((v) => ({ json: v })) ?? [],
|
||||
'manual',
|
||||
{},
|
||||
);
|
||||
|
||||
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}`;
|
||||
};
|
||||
Reference in New Issue
Block a user