n8n/packages/nodes-base/nodes/DateTime/V2/ExtractDateDescription.ts
Michael Kret aea3c50131
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>
2023-11-09 17:57:33 +02:00

97 lines
1.8 KiB
TypeScript

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-examples/expressions/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],
},
];