n8n-nodes-base
Version:
Base nodes of n8n
78 lines (73 loc) • 2.45 kB
text/typescript
/**
* Date & Time Node - Version 1
* Allows you to manipulate date and time values
*/
export interface DateTimeV1Params {
action?: 'calculate' | 'format' | Expression<string>;
/**
* The value that should be converted
* @displayOptions.show { action: ["format"] }
*/
value?: string | Expression<string> | PlaceholderValue;
/**
* Name of the property to which to write the converted date
* @displayOptions.show { action: ["format"] }
* @default data
*/
dataPropertyName?: string | Expression<string> | PlaceholderValue;
/**
* Whether a predefined format should be selected or custom format entered
* @displayOptions.show { action: ["format"] }
* @default false
*/
custom?: boolean | Expression<boolean>;
/**
* The format to convert the date to
* @displayOptions.show { action: ["format"], custom: [true] }
*/
toFormat?: string | Expression<string> | PlaceholderValue;
/**
* Options
* @displayOptions.show { action: ["format"] }
* @default {}
*/
options?: {
/** In case the input format is not recognized you can provide the format
*/
fromFormat?: string | Expression<string> | PlaceholderValue;
/** The timezone to convert from. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.
* @default UTC
*/
fromTimezone?: string | Expression<string>;
/** The timezone to convert to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.
* @default UTC
*/
toTimezone?: string | Expression<string>;
};
/**
* Operation
* @displayOptions.show { action: ["calculate"] }
* @default add
*/
operation?: 'add' | 'subtract';
/**
* E.g. enter “10” then select “Days” if you want to add 10 days to Date Value.
* @displayOptions.show { action: ["calculate"] }
* @default 0
*/
duration?: number | Expression<number>;
/**
* Time unit for Duration parameter above
* @displayOptions.show { action: ["calculate"] }
* @default days
*/
timeUnit?: 'quarters' | 'years' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds' | Expression<string>;
}
interface DateTimeV1NodeBase {
type: 'n8n-nodes-base.dateTime';
version: 1;
}
export type DateTimeV1ParamsNode = DateTimeV1NodeBase & {
config: NodeConfig<DateTimeV1Params>;
};
export type DateTimeV1Node = DateTimeV1ParamsNode;