mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat(Date & Time Node): Option to include other fields in output item (#7661)
Github issue / Community forum post (link here to close automatically): Community: https://community.n8n.io/t/date-time-deletes-incoming-props/27492/3 GH Issue: https://github.com/n8n-io/n8n/issues/7646 --------- Co-authored-by: Marcus <marcus@n8n.io>
This commit is contained in:
parent
18623c7376
commit
aea3c50131
|
@ -2,7 +2,6 @@ import type { INodeTypeBaseDescription, IVersionedNodeType } from 'n8n-workflow'
|
||||||
import { VersionedNodeType } from 'n8n-workflow';
|
import { VersionedNodeType } from 'n8n-workflow';
|
||||||
|
|
||||||
import { DateTimeV1 } from './V1/DateTimeV1.node';
|
import { DateTimeV1 } from './V1/DateTimeV1.node';
|
||||||
|
|
||||||
import { DateTimeV2 } from './V2/DateTimeV2.node';
|
import { DateTimeV2 } from './V2/DateTimeV2.node';
|
||||||
|
|
||||||
export class DateTime extends VersionedNodeType {
|
export class DateTime extends VersionedNodeType {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
import { includeInputFields } from './common.descriptions';
|
||||||
|
|
||||||
export const AddToDateDescription: INodeProperties[] = [
|
export const AddToDateDescription: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
|
@ -102,4 +103,17 @@ export const AddToDateDescription: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Options',
|
||||||
|
name: 'options',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Option',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: ['addToDate'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [includeInputFields],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
import { includeInputFields } from './common.descriptions';
|
||||||
|
|
||||||
export const CurrentDateDescription: INodeProperties[] = [
|
export const CurrentDateDescription: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
|
@ -50,6 +51,7 @@ export const CurrentDateDescription: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
|
includeInputFields,
|
||||||
{
|
{
|
||||||
displayName: 'Timezone',
|
displayName: 'Timezone',
|
||||||
name: 'timezone',
|
name: 'timezone',
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodeType,
|
INodeType,
|
||||||
|
@ -84,134 +83,142 @@ export class DateTimeV2 implements INodeType {
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: INodeExecutionData[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const responseData = [];
|
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
const workflowTimezone = this.getTimezone();
|
const workflowTimezone = this.getTimezone();
|
||||||
|
const includeInputFields = this.getNodeParameter(
|
||||||
|
'options.includeInputFields',
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
) as boolean;
|
||||||
|
|
||||||
|
const copyShallow = (item: INodeExecutionData) => ({
|
||||||
|
json: { ...item.json },
|
||||||
|
binary: item.binary,
|
||||||
|
});
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
if (operation === 'getCurrentDate') {
|
try {
|
||||||
const includeTime = this.getNodeParameter('includeTime', i) as boolean;
|
const item: INodeExecutionData = includeInputFields ? copyShallow(items[i]) : { json: {} };
|
||||||
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
item.pairedItem = {
|
||||||
const { timezone } = this.getNodeParameter('options', i) as {
|
item: i,
|
||||||
timezone: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const newLocal = timezone ? timezone : workflowTimezone;
|
if (operation === 'getCurrentDate') {
|
||||||
if (DateTime.now().setZone(newLocal).invalidReason === 'unsupported zone') {
|
const includeTime = this.getNodeParameter('includeTime', i) as boolean;
|
||||||
throw new NodeOperationError(
|
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
||||||
this.getNode(),
|
const { timezone } = this.getNodeParameter('options', i) as {
|
||||||
`The timezone ${newLocal} is not valid. Please check the timezone.`,
|
timezone: string;
|
||||||
);
|
};
|
||||||
}
|
|
||||||
responseData.push(
|
|
||||||
includeTime
|
|
||||||
? { [outputFieldName]: DateTime.now().setZone(newLocal).toString() }
|
|
||||||
: {
|
|
||||||
[outputFieldName]: DateTime.now().setZone(newLocal).startOf('day').toString(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else if (operation === 'addToDate') {
|
|
||||||
const addToDate = this.getNodeParameter('magnitude', i) as string;
|
|
||||||
const timeUnit = this.getNodeParameter('timeUnit', i) as string;
|
|
||||||
const duration = this.getNodeParameter('duration', i) as number;
|
|
||||||
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
|
||||||
|
|
||||||
const dateToAdd = parseDate.call(this, addToDate, workflowTimezone);
|
const newLocal = timezone ? timezone : workflowTimezone;
|
||||||
const returnedDate = dateToAdd.plus({ [timeUnit]: duration });
|
if (DateTime.now().setZone(newLocal).invalidReason === 'unsupported zone') {
|
||||||
responseData.push({ [outputFieldName]: returnedDate.toString() });
|
throw new NodeOperationError(
|
||||||
} else if (operation === 'subtractFromDate') {
|
this.getNode(),
|
||||||
const subtractFromDate = this.getNodeParameter('magnitude', i) as string;
|
`The timezone ${newLocal} is not valid. Please check the timezone.`,
|
||||||
const timeUnit = this.getNodeParameter('timeUnit', i) as string;
|
);
|
||||||
const duration = this.getNodeParameter('duration', i) as number;
|
|
||||||
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
|
||||||
|
|
||||||
const dateToAdd = parseDate.call(this, subtractFromDate, workflowTimezone);
|
|
||||||
const returnedDate = dateToAdd.minus({ [timeUnit]: duration });
|
|
||||||
responseData.push({ [outputFieldName]: returnedDate.toString() });
|
|
||||||
} else if (operation === 'formatDate') {
|
|
||||||
const date = this.getNodeParameter('date', i) as string;
|
|
||||||
const format = this.getNodeParameter('format', i) as string;
|
|
||||||
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
|
||||||
const { timezone } = this.getNodeParameter('options', i) as { timezone: boolean };
|
|
||||||
|
|
||||||
if (date === null || date === undefined) {
|
|
||||||
responseData.push({
|
|
||||||
[outputFieldName]: date,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const dateLuxon = timezone
|
|
||||||
? parseDate.call(this, date, workflowTimezone)
|
|
||||||
: parseDate.call(this, date);
|
|
||||||
if (format === 'custom') {
|
|
||||||
const customFormat = this.getNodeParameter('customFormat', i) as string;
|
|
||||||
responseData.push({
|
|
||||||
[outputFieldName]: dateLuxon.toFormat(customFormat),
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
responseData.push({
|
|
||||||
[outputFieldName]: dateLuxon.toFormat(format),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (operation === 'roundDate') {
|
|
||||||
const date = this.getNodeParameter('date', i) as string;
|
|
||||||
const mode = this.getNodeParameter('mode', i) as string;
|
|
||||||
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
|
||||||
|
|
||||||
const dateLuxon = parseDate.call(this, date, workflowTimezone);
|
if (includeTime) {
|
||||||
|
item.json[outputFieldName] = DateTime.now().setZone(newLocal).toString();
|
||||||
|
} else {
|
||||||
|
item.json[outputFieldName] = DateTime.now().setZone(newLocal).startOf('day').toString();
|
||||||
|
}
|
||||||
|
returnData.push(item);
|
||||||
|
} else if (operation === 'addToDate') {
|
||||||
|
const addToDate = this.getNodeParameter('magnitude', i) as string;
|
||||||
|
const timeUnit = this.getNodeParameter('timeUnit', i) as string;
|
||||||
|
const duration = this.getNodeParameter('duration', i) as number;
|
||||||
|
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
||||||
|
|
||||||
if (mode === 'roundDown') {
|
const dateToAdd = parseDate.call(this, addToDate, workflowTimezone);
|
||||||
const toNearest = this.getNodeParameter('toNearest', i) as string;
|
const returnedDate = dateToAdd.plus({ [timeUnit]: duration });
|
||||||
responseData.push({
|
|
||||||
[outputFieldName]: dateLuxon.startOf(toNearest as DateTimeUnit).toString(),
|
item.json[outputFieldName] = returnedDate.toString();
|
||||||
});
|
returnData.push(item);
|
||||||
} else if (mode === 'roundUp') {
|
} else if (operation === 'subtractFromDate') {
|
||||||
const to = this.getNodeParameter('to', i) as string;
|
const subtractFromDate = this.getNodeParameter('magnitude', i) as string;
|
||||||
responseData.push({
|
const timeUnit = this.getNodeParameter('timeUnit', i) as string;
|
||||||
[outputFieldName]: dateLuxon
|
const duration = this.getNodeParameter('duration', i) as number;
|
||||||
|
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
||||||
|
|
||||||
|
const dateToAdd = parseDate.call(this, subtractFromDate, workflowTimezone);
|
||||||
|
const returnedDate = dateToAdd.minus({ [timeUnit]: duration });
|
||||||
|
|
||||||
|
item.json[outputFieldName] = returnedDate.toString();
|
||||||
|
returnData.push(item);
|
||||||
|
} else if (operation === 'formatDate') {
|
||||||
|
const date = this.getNodeParameter('date', i) as string;
|
||||||
|
const format = this.getNodeParameter('format', i) as string;
|
||||||
|
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
||||||
|
const { timezone } = this.getNodeParameter('options', i) as { timezone: boolean };
|
||||||
|
|
||||||
|
if (date === null || date === undefined) {
|
||||||
|
item.json[outputFieldName] = date;
|
||||||
|
} else {
|
||||||
|
const dateLuxon = timezone
|
||||||
|
? parseDate.call(this, date, workflowTimezone)
|
||||||
|
: parseDate.call(this, date);
|
||||||
|
if (format === 'custom') {
|
||||||
|
const customFormat = this.getNodeParameter('customFormat', i) as string;
|
||||||
|
item.json[outputFieldName] = dateLuxon.toFormat(customFormat);
|
||||||
|
} else {
|
||||||
|
item.json[outputFieldName] = dateLuxon.toFormat(format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
returnData.push(item);
|
||||||
|
} else if (operation === 'roundDate') {
|
||||||
|
const date = this.getNodeParameter('date', i) as string;
|
||||||
|
const mode = this.getNodeParameter('mode', i) as string;
|
||||||
|
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
||||||
|
|
||||||
|
const dateLuxon = parseDate.call(this, date, workflowTimezone);
|
||||||
|
|
||||||
|
if (mode === 'roundDown') {
|
||||||
|
const toNearest = this.getNodeParameter('toNearest', i) as string;
|
||||||
|
item.json[outputFieldName] = dateLuxon.startOf(toNearest as DateTimeUnit).toString();
|
||||||
|
} else if (mode === 'roundUp') {
|
||||||
|
const to = this.getNodeParameter('to', i) as string;
|
||||||
|
item.json[outputFieldName] = dateLuxon
|
||||||
.plus({ [to]: 1 })
|
.plus({ [to]: 1 })
|
||||||
.startOf(to as DateTimeUnit)
|
.startOf(to as DateTimeUnit)
|
||||||
.toString(),
|
.toString();
|
||||||
});
|
}
|
||||||
|
returnData.push(item);
|
||||||
|
} else if (operation === 'getTimeBetweenDates') {
|
||||||
|
const startDate = this.getNodeParameter('startDate', i) as string;
|
||||||
|
const endDate = this.getNodeParameter('endDate', i) as string;
|
||||||
|
const unit = this.getNodeParameter('units', i) as DurationUnit[];
|
||||||
|
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
||||||
|
const { isoString } = this.getNodeParameter('options', i) as {
|
||||||
|
isoString: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
const luxonStartDate = parseDate.call(this, startDate, workflowTimezone);
|
||||||
|
const luxonEndDate = parseDate.call(this, endDate, workflowTimezone);
|
||||||
|
const duration = luxonEndDate.diff(luxonStartDate, unit);
|
||||||
|
if (isoString) {
|
||||||
|
item.json[outputFieldName] = duration.toString();
|
||||||
|
} else {
|
||||||
|
item.json[outputFieldName] = duration.toObject();
|
||||||
|
}
|
||||||
|
returnData.push(item);
|
||||||
|
} else if (operation === 'extractDate') {
|
||||||
|
const date = this.getNodeParameter('date', i) as string | DateTime;
|
||||||
|
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
||||||
|
const part = this.getNodeParameter('part', i) as keyof DateTime | 'week';
|
||||||
|
|
||||||
|
const parsedDate = parseDate.call(this, date, workflowTimezone);
|
||||||
|
const selectedPart = part === 'week' ? parsedDate.weekNumber : parsedDate.get(part);
|
||||||
|
item.json[outputFieldName] = selectedPart;
|
||||||
|
returnData.push(item);
|
||||||
}
|
}
|
||||||
} else if (operation === 'getTimeBetweenDates') {
|
} catch (error) {
|
||||||
const startDate = this.getNodeParameter('startDate', i) as string;
|
if (this.continueOnFail()) {
|
||||||
const endDate = this.getNodeParameter('endDate', i) as string;
|
returnData.push({ json: { error: error.message } });
|
||||||
const unit = this.getNodeParameter('units', i) as DurationUnit[];
|
continue;
|
||||||
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
}
|
||||||
const { isoString } = this.getNodeParameter('options', i) as {
|
throw new NodeOperationError(this.getNode(), error, { itemIndex: i });
|
||||||
isoString: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
const luxonStartDate = parseDate.call(this, startDate, workflowTimezone);
|
|
||||||
const luxonEndDate = parseDate.call(this, endDate, workflowTimezone);
|
|
||||||
const duration = luxonEndDate.diff(luxonStartDate, unit);
|
|
||||||
isoString
|
|
||||||
? responseData.push({
|
|
||||||
[outputFieldName]: duration.toString(),
|
|
||||||
})
|
|
||||||
: responseData.push({
|
|
||||||
[outputFieldName]: duration.toObject(),
|
|
||||||
});
|
|
||||||
} else if (operation === 'extractDate') {
|
|
||||||
const date = this.getNodeParameter('date', i) as string | DateTime;
|
|
||||||
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
|
||||||
const part = this.getNodeParameter('part', i) as keyof DateTime | 'week';
|
|
||||||
|
|
||||||
const parsedDate = parseDate.call(this, date, workflowTimezone);
|
|
||||||
const selectedPart = part === 'week' ? parsedDate.weekNumber : parsedDate.get(part);
|
|
||||||
responseData.push({ [outputFieldName]: selectedPart });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const executionData = this.helpers.constructExecutionMetaData(
|
|
||||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
|
||||||
{
|
|
||||||
itemData: { item: i },
|
|
||||||
},
|
|
||||||
);
|
|
||||||
returnData.push(...executionData);
|
|
||||||
// Reset responseData
|
|
||||||
responseData.length = 0;
|
|
||||||
}
|
}
|
||||||
return [returnData];
|
return [returnData];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
import { includeInputFields } from './common.descriptions';
|
||||||
|
|
||||||
export const ExtractDateDescription: INodeProperties[] = [
|
export const ExtractDateDescription: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
|
@ -79,4 +80,17 @@ export const ExtractDateDescription: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Options',
|
||||||
|
name: 'options',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Option',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: ['extractDate'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [includeInputFields],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
import { includeInputFields } from './common.descriptions';
|
||||||
|
|
||||||
export const FormatDateDescription: INodeProperties[] = [
|
export const FormatDateDescription: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
|
@ -117,6 +118,7 @@ export const FormatDateDescription: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
|
includeInputFields,
|
||||||
{
|
{
|
||||||
displayName: 'Use Workflow Timezone',
|
displayName: 'Use Workflow Timezone',
|
||||||
name: 'timezone',
|
name: 'timezone',
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
import { includeInputFields } from './common.descriptions';
|
||||||
|
|
||||||
export const GetTimeBetweenDatesDescription: INodeProperties[] = [
|
export const GetTimeBetweenDatesDescription: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
|
@ -93,6 +94,7 @@ export const GetTimeBetweenDatesDescription: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
|
includeInputFields,
|
||||||
{
|
{
|
||||||
displayName: 'Output as ISO String',
|
displayName: 'Output as ISO String',
|
||||||
name: 'isoString',
|
name: 'isoString',
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
import { includeInputFields } from './common.descriptions';
|
||||||
|
|
||||||
export const RoundDateDescription: INodeProperties[] = [
|
export const RoundDateDescription: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
|
@ -119,4 +120,17 @@ export const RoundDateDescription: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Options',
|
||||||
|
name: 'options',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Option',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: ['roundDate'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [includeInputFields],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
import { includeInputFields } from './common.descriptions';
|
||||||
|
|
||||||
export const SubtractFromDateDescription: INodeProperties[] = [
|
export const SubtractFromDateDescription: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
|
@ -102,4 +103,17 @@ export const SubtractFromDateDescription: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Options',
|
||||||
|
name: 'options',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Option',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: ['subtractFromDate'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [includeInputFields],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
|
export const includeInputFields: INodeProperties = {
|
||||||
|
displayName: 'Include Input Fields',
|
||||||
|
name: 'includeInputFields',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Whether to include all fields of the input item in the output item',
|
||||||
|
};
|
|
@ -0,0 +1,420 @@
|
||||||
|
{
|
||||||
|
"name": "My workflow 38",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"parameters": {},
|
||||||
|
"id": "f1242de8-11fc-4849-a4a2-c82fa75731a7",
|
||||||
|
"name": "When clicking \"Execute Workflow\"",
|
||||||
|
"type": "n8n-nodes-base.manualTrigger",
|
||||||
|
"typeVersion": 1,
|
||||||
|
"position": [
|
||||||
|
120,
|
||||||
|
800
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"values": {
|
||||||
|
"number": [
|
||||||
|
{
|
||||||
|
"name": "dateMilis",
|
||||||
|
"value": 1682918315906
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dateMilisFloat",
|
||||||
|
"value": 1682918315.906
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dateUnix",
|
||||||
|
"value": 1682918315
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"string": [
|
||||||
|
{
|
||||||
|
"name": "dateMilisStr",
|
||||||
|
"value": "1682918315906"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dateMilisFloatStr",
|
||||||
|
"value": "1682918315.906"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dateUnixStr",
|
||||||
|
"value": "1682918315"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
"id": "7208910f-fd33-42b9-bcf2-14bb0b0d157d",
|
||||||
|
"name": "Set",
|
||||||
|
"type": "n8n-nodes-base.set",
|
||||||
|
"typeVersion": 2,
|
||||||
|
"position": [
|
||||||
|
320,
|
||||||
|
800
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"operation": "formatDate",
|
||||||
|
"date": "={{ $json.dateMilis }}",
|
||||||
|
"format": "yyyy/MM/dd",
|
||||||
|
"outputFieldName": "data",
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
"id": "fb66a2cc-95b9-4917-999b-847ab61a7938",
|
||||||
|
"name": "Date & Time6",
|
||||||
|
"type": "n8n-nodes-base.dateTime",
|
||||||
|
"typeVersion": 2,
|
||||||
|
"position": [
|
||||||
|
700,
|
||||||
|
360
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"operation": "formatDate",
|
||||||
|
"date": "={{ $json.dateMilisFloat }}",
|
||||||
|
"format": "yyyy/MM/dd",
|
||||||
|
"outputFieldName": "data",
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
"id": "b94eb54a-1952-4f33-816a-8ffa47c7bb42",
|
||||||
|
"name": "Date & Time",
|
||||||
|
"type": "n8n-nodes-base.dateTime",
|
||||||
|
"typeVersion": 2,
|
||||||
|
"position": [
|
||||||
|
700,
|
||||||
|
720
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"operation": "formatDate",
|
||||||
|
"date": "={{ $json.dateUnix }}",
|
||||||
|
"format": "yyyy/MM/dd",
|
||||||
|
"outputFieldName": "data",
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
"id": "7f0af92d-8064-4af0-8c2c-a21b70f69ac1",
|
||||||
|
"name": "Date & Time1",
|
||||||
|
"type": "n8n-nodes-base.dateTime",
|
||||||
|
"typeVersion": 2,
|
||||||
|
"position": [
|
||||||
|
700,
|
||||||
|
1080
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {},
|
||||||
|
"id": "1e90549e-f4d4-46a1-bc9b-617befff2319",
|
||||||
|
"name": "No Operation, do nothing",
|
||||||
|
"type": "n8n-nodes-base.noOp",
|
||||||
|
"typeVersion": 1,
|
||||||
|
"position": [
|
||||||
|
900,
|
||||||
|
360
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {},
|
||||||
|
"id": "ec07d232-e513-4f09-8cb1-e8e4853bcebc",
|
||||||
|
"name": "No Operation, do nothing1",
|
||||||
|
"type": "n8n-nodes-base.noOp",
|
||||||
|
"typeVersion": 1,
|
||||||
|
"position": [
|
||||||
|
900,
|
||||||
|
720
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {},
|
||||||
|
"id": "f9839c73-ed5e-4ae0-bc1e-5a1914ac8b55",
|
||||||
|
"name": "No Operation, do nothing2",
|
||||||
|
"type": "n8n-nodes-base.noOp",
|
||||||
|
"typeVersion": 1,
|
||||||
|
"position": [
|
||||||
|
900,
|
||||||
|
1080
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"operation": "formatDate",
|
||||||
|
"date": "={{ $json.dateMilis }}",
|
||||||
|
"format": "yyyy/MM/dd",
|
||||||
|
"outputFieldName": "data",
|
||||||
|
"options": {
|
||||||
|
"includeInputFields": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": "bfce6276-2de4-4783-bc7f-d82fab23c2af",
|
||||||
|
"name": "Date & Time7",
|
||||||
|
"type": "n8n-nodes-base.dateTime",
|
||||||
|
"typeVersion": 2,
|
||||||
|
"position": [
|
||||||
|
700,
|
||||||
|
500
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"operation": "formatDate",
|
||||||
|
"date": "={{ $json.dateMilisFloat }}",
|
||||||
|
"format": "yyyy/MM/dd",
|
||||||
|
"outputFieldName": "data",
|
||||||
|
"options": {
|
||||||
|
"includeInputFields": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": "a7aad9c9-20ff-4353-9445-80366fad9431",
|
||||||
|
"name": "Date & Time2",
|
||||||
|
"type": "n8n-nodes-base.dateTime",
|
||||||
|
"typeVersion": 2,
|
||||||
|
"position": [
|
||||||
|
700,
|
||||||
|
860
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"operation": "formatDate",
|
||||||
|
"date": "={{ $json.dateUnix }}",
|
||||||
|
"format": "yyyy/MM/dd",
|
||||||
|
"outputFieldName": "data",
|
||||||
|
"options": {
|
||||||
|
"includeInputFields": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": "3b9e3ad7-0d00-4598-b796-23bb206e75db",
|
||||||
|
"name": "Date & Time3",
|
||||||
|
"type": "n8n-nodes-base.dateTime",
|
||||||
|
"typeVersion": 2,
|
||||||
|
"position": [
|
||||||
|
700,
|
||||||
|
1240
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {},
|
||||||
|
"id": "8a3cdde0-b1de-46dc-a8c6-74cc174fd4a1",
|
||||||
|
"name": "No Operation, do nothing3",
|
||||||
|
"type": "n8n-nodes-base.noOp",
|
||||||
|
"typeVersion": 1,
|
||||||
|
"position": [
|
||||||
|
900,
|
||||||
|
1240
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {},
|
||||||
|
"id": "54b4d584-0874-411b-9c98-8194c0928588",
|
||||||
|
"name": "No Operation, do nothing4",
|
||||||
|
"type": "n8n-nodes-base.noOp",
|
||||||
|
"typeVersion": 1,
|
||||||
|
"position": [
|
||||||
|
900,
|
||||||
|
860
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {},
|
||||||
|
"id": "4a4e7647-6c6e-4a24-9032-829e5f495337",
|
||||||
|
"name": "No Operation, do nothing5",
|
||||||
|
"type": "n8n-nodes-base.noOp",
|
||||||
|
"typeVersion": 1,
|
||||||
|
"position": [
|
||||||
|
900,
|
||||||
|
500
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pinData": {
|
||||||
|
"No Operation, do nothing2": [
|
||||||
|
{
|
||||||
|
"json": {
|
||||||
|
"data": "2023/05/01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"No Operation, do nothing1": [
|
||||||
|
{
|
||||||
|
"json": {
|
||||||
|
"data": "2023/05/01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"No Operation, do nothing": [
|
||||||
|
{
|
||||||
|
"json": {
|
||||||
|
"data": "2023/05/01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"No Operation, do nothing5": [
|
||||||
|
{
|
||||||
|
"json": {
|
||||||
|
"dateMilis": 1682918315906,
|
||||||
|
"dateMilisFloat": 1682918315.906,
|
||||||
|
"dateUnix": 1682918315,
|
||||||
|
"dateMilisStr": "1682918315906",
|
||||||
|
"dateMilisFloatStr": "1682918315.906",
|
||||||
|
"dateUnixStr": "1682918315",
|
||||||
|
"data": "2023/05/01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"No Operation, do nothing4": [
|
||||||
|
{
|
||||||
|
"json": {
|
||||||
|
"dateMilis": 1682918315906,
|
||||||
|
"dateMilisFloat": 1682918315.906,
|
||||||
|
"dateUnix": 1682918315,
|
||||||
|
"dateMilisStr": "1682918315906",
|
||||||
|
"dateMilisFloatStr": "1682918315.906",
|
||||||
|
"dateUnixStr": "1682918315",
|
||||||
|
"data": "2023/05/01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"No Operation, do nothing3": [
|
||||||
|
{
|
||||||
|
"json": {
|
||||||
|
"dateMilis": 1682918315906,
|
||||||
|
"dateMilisFloat": 1682918315.906,
|
||||||
|
"dateUnix": 1682918315,
|
||||||
|
"dateMilisStr": "1682918315906",
|
||||||
|
"dateMilisFloatStr": "1682918315.906",
|
||||||
|
"dateUnixStr": "1682918315",
|
||||||
|
"data": "2023/05/01"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"connections": {
|
||||||
|
"When clicking \"Execute Workflow\"": {
|
||||||
|
"main": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"node": "Set",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Set": {
|
||||||
|
"main": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"node": "Date & Time6",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"node": "Date & Time",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"node": "Date & Time1",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"node": "Date & Time7",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"node": "Date & Time2",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"node": "Date & Time3",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Date & Time6": {
|
||||||
|
"main": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"node": "No Operation, do nothing",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Date & Time1": {
|
||||||
|
"main": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"node": "No Operation, do nothing2",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Date & Time": {
|
||||||
|
"main": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"node": "No Operation, do nothing1",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Date & Time3": {
|
||||||
|
"main": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"node": "No Operation, do nothing3",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Date & Time2": {
|
||||||
|
"main": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"node": "No Operation, do nothing4",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Date & Time7": {
|
||||||
|
"main": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"node": "No Operation, do nothing5",
|
||||||
|
"type": "main",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"active": false,
|
||||||
|
"settings": {
|
||||||
|
"executionOrder": "v1"
|
||||||
|
},
|
||||||
|
"versionId": "419a6926-5d06-4ba5-b261-410e124996de",
|
||||||
|
"id": "hW8KyOyaCN5fGQru",
|
||||||
|
"meta": {
|
||||||
|
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
}
|
Loading…
Reference in a new issue