/** * Date & Time Node - Version 2 * Manipulate date and time values */ export interface DateTimeV2Params { operation?: 'addToDate' | 'extractDate' | 'formatDate' | 'getCurrentDate' | 'getTimeBetweenDates' | 'roundDate' | 'subtractFromDate'; /** * When deactivated, the time will be set to midnight * @displayOptions.show { operation: ["getCurrentDate"] } * @default true */ includeTime?: boolean | Expression; /** * Name of the field to put the output in * @displayOptions.show { operation: ["getCurrentDate"] } * @default currentDate */ outputFieldName?: string | Expression | PlaceholderValue; /** * Options * @displayOptions.show { operation: ["getCurrentDate"] } * @default {} */ options?: { /** Whether to include all fields of the input item in the output item * @default false */ includeInputFields?: boolean | Expression; /** The timezone to use. If not set, the timezone of the n8n instance will be used. Use ‘GMT’ for +00:00 timezone. */ timezone?: string | Expression | PlaceholderValue; /** 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. * @hint Tokens are case sensitive * @default e.g yyyyMMdd */ fromFormat?: string | Expression | PlaceholderValue; /** Whether to output the date as ISO string or not * @default false */ isoString?: boolean | Expression; }; /** * The date that you want to change * @displayOptions.show { operation: ["addToDate"] } */ magnitude?: string | Expression | PlaceholderValue; /** * Time unit for Duration parameter below * @displayOptions.show { operation: ["addToDate"] } * @default days */ timeUnit?: 'years' | 'quarters' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds' | Expression; /** * The number of time units to add to the date * @displayOptions.show { operation: ["addToDate"] } * @default 0 */ duration?: number | Expression; /** * The date that you want to format * @displayOptions.show { operation: ["formatDate"] } */ date?: string | Expression | PlaceholderValue; /** * The format to convert the date to * @displayOptions.show { operation: ["formatDate"] } * @default MM/dd/yyyy */ format?: 'custom' | 'MM/dd/yyyy' | 'yyyy/MM/dd' | 'MMMM dd yyyy' | 'MM-dd-yyyy' | 'yyyy-MM-dd' | 'X' | 'x' | Expression; /** * Custom Format * @hint List of special tokens <a target="_blank" href="https://moment.github.io/luxon/#/formatting?id=table-of-tokens">More info</a> * @displayOptions.show { format: ["custom"], operation: ["formatDate"] } */ customFormat?: string | Expression | PlaceholderValue; /** * Mode * @displayOptions.show { operation: ["roundDate"] } * @default roundDown */ mode?: 'roundDown' | 'roundUp' | Expression; /** * To Nearest * @displayOptions.show { operation: ["roundDate"], mode: ["roundDown"] } * @default month */ toNearest?: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | Expression; /** * To * @displayOptions.show { operation: ["roundDate"], mode: ["roundUp"] } * @default month */ to?: 'month' | Expression; /** * Start Date * @displayOptions.show { operation: ["getTimeBetweenDates"] } */ startDate?: string | Expression | PlaceholderValue; /** * End Date * @displayOptions.show { operation: ["getTimeBetweenDates"] } */ endDate?: string | Expression | PlaceholderValue; /** * Units * @displayOptions.show { operation: ["getTimeBetweenDates"] } * @default ["day"] */ units?: Array<'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'>; /** * Part * @displayOptions.show { operation: ["extractDate"] } * @default month */ part?: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | Expression; } interface DateTimeV2NodeBase { type: 'n8n-nodes-base.dateTime'; version: 2; } export type DateTimeV2ParamsNode = DateTimeV2NodeBase & { config: NodeConfig; }; export type DateTimeV2Node = DateTimeV2ParamsNode;