first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,120 @@
import type { INodeProperties } from 'n8n-workflow';
import { includeInputFields } from './common.descriptions';
export const AddToDateDescription: INodeProperties[] = [
{
displayName:
"You can also do this using an expression, e.g. <code>{{your_date.plus(5, 'minutes')}}</code>. <a target='_blank' href='https://docs.n8n.io/code/cookbook/luxon/'>More info</a>",
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
show: {
operation: ['addToDate'],
},
},
},
{
displayName: 'Date to Add To',
name: 'magnitude',
type: 'string',
description: 'The date that you want to change',
default: '',
displayOptions: {
show: {
operation: ['addToDate'],
},
},
required: true,
},
{
displayName: 'Time Unit to Add',
name: 'timeUnit',
description: 'Time unit for Duration parameter below',
displayOptions: {
show: {
operation: ['addToDate'],
},
},
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'Years',
value: 'years',
},
{
name: 'Quarters',
value: 'quarters',
},
{
name: 'Months',
value: 'months',
},
{
name: 'Weeks',
value: 'weeks',
},
{
name: 'Days',
value: 'days',
},
{
name: 'Hours',
value: 'hours',
},
{
name: 'Minutes',
value: 'minutes',
},
{
name: 'Seconds',
value: 'seconds',
},
{
name: 'Milliseconds',
value: 'milliseconds',
},
],
default: 'days',
required: true,
},
{
displayName: 'Duration',
name: 'duration',
type: 'number',
description: 'The number of time units to add to the date',
default: 0,
displayOptions: {
show: {
operation: ['addToDate'],
},
},
},
{
displayName: 'Output Field Name',
name: 'outputFieldName',
type: 'string',
default: 'newDate',
description: 'Name of the field to put the output in',
displayOptions: {
show: {
operation: ['addToDate'],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
displayOptions: {
show: {
operation: ['addToDate'],
},
},
default: {},
options: [includeInputFields],
},
];
@@ -0,0 +1,67 @@
import type { INodeProperties } from 'n8n-workflow';
import { includeInputFields } from './common.descriptions';
export const CurrentDateDescription: INodeProperties[] = [
{
displayName:
'You can also refer to the current date in n8n expressions by using <code>{{$now}}</code> or <code>{{$today}}</code>. <a target="_blank" href="https://docs.n8n.io/code/cookbook/luxon/">More info</a>',
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
show: {
operation: ['getCurrentDate'],
},
},
},
{
displayName: 'Include Current Time',
name: 'includeTime',
type: 'boolean',
default: true,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'When deactivated, the time will be set to midnight',
displayOptions: {
show: {
operation: ['getCurrentDate'],
},
},
},
{
displayName: 'Output Field Name',
name: 'outputFieldName',
type: 'string',
default: 'currentDate',
description: 'Name of the field to put the output in',
displayOptions: {
show: {
operation: ['getCurrentDate'],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
displayOptions: {
show: {
operation: ['getCurrentDate'],
},
},
default: {},
options: [
includeInputFields,
{
displayName: 'Timezone',
name: 'timezone',
type: 'string',
placeholder: 'America/New_York',
default: '',
description:
'The timezone to use. If not set, the timezone of the n8n instance will be used. Use GMT for +00:00 timezone.',
},
],
},
];
@@ -0,0 +1,231 @@
import type { DateTimeUnit, DurationUnit } from 'luxon';
import { DateTime } from 'luxon';
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
import type {
IExecuteFunctions,
INodeExecutionData,
INodeType,
INodeTypeBaseDescription,
INodeTypeDescription,
} from 'n8n-workflow';
import { AddToDateDescription } from './AddToDateDescription';
import { CurrentDateDescription } from './CurrentDateDescription';
import { ExtractDateDescription } from './ExtractDateDescription';
import { FormatDateDescription } from './FormatDateDescription';
import { parseDate } from './GenericFunctions';
import { GetTimeBetweenDatesDescription } from './GetTimeBetweenDates';
import { RoundDateDescription } from './RoundDateDescription';
import { SubtractFromDateDescription } from './SubtractFromDateDescription';
export class DateTimeV2 implements INodeType {
description: INodeTypeDescription;
constructor(baseDescription: INodeTypeBaseDescription) {
this.description = {
...baseDescription,
version: 2,
defaults: {
name: 'Date & Time',
color: '#408000',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
description: 'Manipulate date and time values',
properties: [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Add to a Date',
value: 'addToDate',
},
{
name: 'Extract Part of a Date',
value: 'extractDate',
},
{
name: 'Format a Date',
value: 'formatDate',
},
{
name: 'Get Current Date',
value: 'getCurrentDate',
},
{
name: 'Get Time Between Dates',
value: 'getTimeBetweenDates',
},
{
name: 'Round a Date',
value: 'roundDate',
},
{
name: 'Subtract From a Date',
value: 'subtractFromDate',
},
],
default: 'getCurrentDate',
},
...CurrentDateDescription,
...AddToDateDescription,
...SubtractFromDateDescription,
...FormatDateDescription,
...RoundDateDescription,
...GetTimeBetweenDatesDescription,
...ExtractDateDescription,
],
};
}
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: INodeExecutionData[] = [];
const operation = this.getNodeParameter('operation', 0);
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++) {
try {
const item: INodeExecutionData = includeInputFields ? copyShallow(items[i]) : { json: {} };
item.pairedItem = {
item: i,
};
if (operation === 'getCurrentDate') {
const includeTime = this.getNodeParameter('includeTime', i) as boolean;
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
const { timezone } = this.getNodeParameter('options', i) as {
timezone: string;
};
const newLocal = timezone ? timezone : workflowTimezone;
if (DateTime.now().setZone(newLocal).invalidReason === 'unsupported zone') {
throw new NodeOperationError(
this.getNode(),
`The timezone ${newLocal} is not valid. Please check the timezone.`,
);
}
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;
const dateToAdd = parseDate.call(this, addToDate, { timezone: workflowTimezone });
const returnedDate = dateToAdd.plus({ [timeUnit]: duration });
item.json[outputFieldName] = returnedDate.toString();
returnData.push(item);
} else if (operation === 'subtractFromDate') {
const subtractFromDate = 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, subtractFromDate, { timezone: 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, fromFormat } = this.getNodeParameter('options', i) as {
timezone: boolean;
fromFormat: string;
};
if (date === null || date === undefined) {
item.json[outputFieldName] = date;
} else {
const dateLuxon = parseDate.call(this, date, {
timezone: timezone ? workflowTimezone : undefined,
fromFormat,
});
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, { timezone: 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 })
.startOf(to as DateTimeUnit)
.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, { timezone: workflowTimezone });
const luxonEndDate = parseDate.call(this, endDate, { timezone: 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, { timezone: workflowTimezone });
const selectedPart = part === 'week' ? parsedDate.weekNumber : parsedDate.get(part);
item.json[outputFieldName] = selectedPart;
returnData.push(item);
}
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
throw new NodeOperationError(this.getNode(), error, { itemIndex: i });
}
}
return [returnData];
}
}
@@ -0,0 +1,97 @@
import type { INodeProperties } from 'n8n-workflow';
import { includeInputFields } from './common.descriptions';
export const ExtractDateDescription: INodeProperties[] = [
{
displayName:
'You can also do this using an expression, e.g. <code>{{ your_date.extract("month") }}}</code>. <a target="_blank" href="https://docs.n8n.io/code/cookbook/luxon/">More info</a>',
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
show: {
operation: ['extractDate'],
},
},
},
{
displayName: 'Date',
name: 'date',
type: 'string',
description: 'The date that you want to round',
default: '',
displayOptions: {
show: {
operation: ['extractDate'],
},
},
},
{
displayName: 'Part',
name: 'part',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'Year',
value: 'year',
},
{
name: 'Month',
value: 'month',
},
{
name: 'Week',
value: 'week',
},
{
name: 'Day',
value: 'day',
},
{
name: 'Hour',
value: 'hour',
},
{
name: 'Minute',
value: 'minute',
},
{
name: 'Second',
value: 'second',
},
],
default: 'month',
displayOptions: {
show: {
operation: ['extractDate'],
},
},
},
{
displayName: 'Output Field Name',
name: 'outputFieldName',
type: 'string',
default: 'datePart',
description: 'Name of the field to put the output in',
displayOptions: {
show: {
operation: ['extractDate'],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
displayOptions: {
show: {
operation: ['extractDate'],
},
},
default: {},
options: [includeInputFields],
},
];
@@ -0,0 +1,142 @@
import type { INodeProperties } from 'n8n-workflow';
import { includeInputFields } from './common.descriptions';
export const FormatDateDescription: INodeProperties[] = [
{
displayName:
"You can also do this using an expression, e.g. <code>{{your_date.format('yyyy-MM-dd')}}</code>. <a target='_blank' href='https://docs.n8n.io/code/cookbook/luxon/'>More info</a>",
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
show: {
operation: ['formatDate'],
},
},
},
{
displayName: 'Date',
name: 'date',
type: 'string',
description: 'The date that you want to format',
default: '',
displayOptions: {
show: {
operation: ['formatDate'],
},
},
},
{
displayName: 'Format',
name: 'format',
type: 'options',
displayOptions: {
show: {
operation: ['formatDate'],
},
},
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'Custom Format',
value: 'custom',
},
{
name: 'MM/DD/YYYY',
value: 'MM/dd/yyyy',
description: 'Example: 09/04/1986',
},
{
name: 'YYYY/MM/DD',
value: 'yyyy/MM/dd',
description: 'Example: 1986/04/09',
},
{
name: 'MMMM DD YYYY',
value: 'MMMM dd yyyy',
description: 'Example: April 09 1986',
},
{
name: 'MM-DD-YYYY',
value: 'MM-dd-yyyy',
description: 'Example: 09-04-1986',
},
{
name: 'YYYY-MM-DD',
value: 'yyyy-MM-dd',
description: 'Example: 1986-04-09',
},
{
name: 'Unix Timestamp',
value: 'X',
description: 'Example: 1672531200',
},
{
name: 'Unix Ms Timestamp',
value: 'x',
description: 'Example: 1674691200000',
},
],
default: 'MM/dd/yyyy',
description: 'The format to convert the date to',
},
{
displayName: 'Custom Format',
name: 'customFormat',
type: 'string',
displayOptions: {
show: {
format: ['custom'],
operation: ['formatDate'],
},
},
hint: 'List of special tokens <a target="_blank" href="https://moment.github.io/luxon/#/formatting?id=table-of-tokens">More info</a>',
default: '',
placeholder: 'yyyy-MM-dd',
},
{
displayName: 'Output Field Name',
name: 'outputFieldName',
type: 'string',
default: 'formattedDate',
description: 'Name of the field to put the output in',
displayOptions: {
show: {
operation: ['formatDate'],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
displayOptions: {
show: {
operation: ['formatDate'],
},
},
default: {},
options: [
includeInputFields,
{
displayName: 'From Date Format',
name: 'fromFormat',
type: 'string',
default: 'e.g yyyyMMdd',
hint: 'Tokens are case sensitive',
// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-id
description:
'Format in which the input \'Date\' is, it\'s helpful when the format is not recognized automatically. Use those <a href="https://moment.github.io/luxon/#/formatting?id=table-of-tokens&id=table-of-tokens" target="_blank">tokens</a> to define the format.',
},
{
displayName: 'Use Workflow Timezone',
name: 'timezone',
type: 'boolean',
default: false,
description: "Whether to use the timezone of the input or the workflow's timezone",
},
],
},
];
@@ -0,0 +1,58 @@
import { DateTime } from 'luxon';
import moment from 'moment-timezone';
import type { IExecuteFunctions } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';
export function parseDate(
this: IExecuteFunctions,
date: string | number | DateTime,
options: Partial<{
timezone: string;
fromFormat: string;
}> = {},
) {
let parsedDate;
if (date instanceof DateTime) {
parsedDate = date;
} else {
// Check if the input is a number, don't convert to number if fromFormat is set
if (!Number.isNaN(Number(date)) && !options.fromFormat) {
//input is a number, convert to number in case it is a string formatted number
date = Number(date);
// check if the number is a timestamp in float format and convert to integer
if (!Number.isInteger(date)) {
date = date * 1000;
}
}
let timezone = options.timezone;
if (Number.isInteger(date)) {
const timestampLengthInMilliseconds1990 = 12;
// check if the number is a timestamp in seconds or milliseconds and create a moment object accordingly
if (date.toString().length < timestampLengthInMilliseconds1990) {
parsedDate = DateTime.fromSeconds(date as number);
} else {
parsedDate = DateTime.fromMillis(date as number);
}
} else {
if (!timezone && (date as string).includes('+')) {
const offset = (date as string).split('+')[1].slice(0, 2) as unknown as number;
timezone = `Etc/GMT-${offset * 1}`;
}
if (options.fromFormat) {
parsedDate = DateTime.fromFormat(date as string, options.fromFormat);
} else {
parsedDate = DateTime.fromISO(moment(date).toISOString());
}
}
parsedDate = parsedDate.setZone(timezone || 'Etc/UTC');
if (parsedDate.invalidReason === 'unparsable') {
throw new NodeOperationError(this.getNode(), 'Invalid date format');
}
}
return parsedDate;
}
@@ -0,0 +1,108 @@
import type { INodeProperties } from 'n8n-workflow';
import { includeInputFields } from './common.descriptions';
export const GetTimeBetweenDatesDescription: INodeProperties[] = [
{
displayName: 'Start Date',
name: 'startDate',
type: 'string',
default: '',
displayOptions: {
show: {
operation: ['getTimeBetweenDates'],
},
},
},
{
displayName: 'End Date',
name: 'endDate',
type: 'string',
default: '',
displayOptions: {
show: {
operation: ['getTimeBetweenDates'],
},
},
},
{
displayName: 'Units',
name: 'units',
type: 'multiOptions',
// eslint-disable-next-line n8n-nodes-base/node-param-multi-options-type-unsorted-items
options: [
{
name: 'Year',
value: 'year',
},
{
name: 'Month',
value: 'month',
},
{
name: 'Week',
value: 'week',
},
{
name: 'Day',
value: 'day',
},
{
name: 'Hour',
value: 'hour',
},
{
name: 'Minute',
value: 'minute',
},
{
name: 'Second',
value: 'second',
},
{
name: 'Millisecond',
value: 'millisecond',
},
],
displayOptions: {
show: {
operation: ['getTimeBetweenDates'],
},
},
default: ['day'],
},
{
displayName: 'Output Field Name',
name: 'outputFieldName',
type: 'string',
default: 'timeDifference',
description: 'Name of the field to put the output in',
displayOptions: {
show: {
operation: ['getTimeBetweenDates'],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
displayOptions: {
show: {
operation: ['getTimeBetweenDates'],
},
},
default: {},
options: [
includeInputFields,
{
displayName: 'Output as ISO String',
name: 'isoString',
type: 'boolean',
default: false,
description: 'Whether to output the date as ISO string or not',
},
],
},
];
@@ -0,0 +1,137 @@
import type { INodeProperties } from 'n8n-workflow';
import { includeInputFields } from './common.descriptions';
export const RoundDateDescription: INodeProperties[] = [
{
displayName:
"You can also do this using an expression, e.g. <code>{{ your_date.beginningOf('month') }}</code> or <code>{{ your_date.endOfMonth() }}</code>. <a target='_blank' href='https://docs.n8n.io/code/cookbook/luxon/'>More info</a>",
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
show: {
operation: ['roundDate'],
},
},
},
{
displayName: 'Date',
name: 'date',
type: 'string',
description: 'The date that you want to round',
default: '',
displayOptions: {
show: {
operation: ['roundDate'],
},
},
},
{
displayName: 'Mode',
name: 'mode',
type: 'options',
options: [
{
name: 'Round Down',
value: 'roundDown',
},
{
name: 'Round Up',
value: 'roundUp',
},
],
default: 'roundDown',
displayOptions: {
show: {
operation: ['roundDate'],
},
},
},
{
displayName: 'To Nearest',
name: 'toNearest',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'Year',
value: 'year',
},
{
name: 'Month',
value: 'month',
},
{
name: 'Week',
value: 'week',
},
{
name: 'Day',
value: 'day',
},
{
name: 'Hour',
value: 'hour',
},
{
name: 'Minute',
value: 'minute',
},
{
name: 'Second',
value: 'second',
},
],
default: 'month',
displayOptions: {
show: {
operation: ['roundDate'],
mode: ['roundDown'],
},
},
},
{
displayName: 'To',
name: 'to',
type: 'options',
options: [
{
name: 'End of Month',
value: 'month',
},
],
default: 'month',
displayOptions: {
show: {
operation: ['roundDate'],
mode: ['roundUp'],
},
},
},
{
displayName: 'Output Field Name',
name: 'outputFieldName',
type: 'string',
default: 'roundedDate',
description: 'Name of the field to put the output in',
displayOptions: {
show: {
operation: ['roundDate'],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
displayOptions: {
show: {
operation: ['roundDate'],
},
},
default: {},
options: [includeInputFields],
},
];
@@ -0,0 +1,120 @@
import type { INodeProperties } from 'n8n-workflow';
import { includeInputFields } from './common.descriptions';
export const SubtractFromDateDescription: INodeProperties[] = [
{
displayName:
"You can also do this using an expression, e.g. <code>{{your_date.minus(5, 'minutes')}}</code>. <a target='_blank' href='https://docs.n8n.io/code/cookbook/luxon/'>More info</a>",
name: 'notice',
type: 'notice',
default: '',
displayOptions: {
show: {
operation: ['subtractFromDate'],
},
},
},
{
displayName: 'Date to Subtract From',
name: 'magnitude',
type: 'string',
description: 'The date that you want to change',
default: '',
displayOptions: {
show: {
operation: ['subtractFromDate'],
},
},
required: true,
},
{
displayName: 'Time Unit to Subtract',
name: 'timeUnit',
description: 'Time unit for Duration parameter below',
displayOptions: {
show: {
operation: ['subtractFromDate'],
},
},
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'Years',
value: 'years',
},
{
name: 'Quarters',
value: 'quarters',
},
{
name: 'Months',
value: 'months',
},
{
name: 'Weeks',
value: 'weeks',
},
{
name: 'Days',
value: 'days',
},
{
name: 'Hours',
value: 'hours',
},
{
name: 'Minutes',
value: 'minutes',
},
{
name: 'Seconds',
value: 'seconds',
},
{
name: 'Milliseconds',
value: 'milliseconds',
},
],
default: 'days',
required: true,
},
{
displayName: 'Duration',
name: 'duration',
type: 'number',
description: 'The number of time units to subtract from the date',
default: 0,
displayOptions: {
show: {
operation: ['subtractFromDate'],
},
},
},
{
displayName: 'Output Field Name',
name: 'outputFieldName',
type: 'string',
default: 'newDate',
description: 'Name of the field to put the output in',
displayOptions: {
show: {
operation: ['subtractFromDate'],
},
},
},
{
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',
};