'Unrecognized date input. Please specify a format in the "From Format" field.',
);
}
constversionDescription: INodeTypeDescription={
displayName:'Date & Time',
name:'dateTime',
icon:'fa:clock',
group:['transform'],
version: 1,
description:'Allows you to manipulate date and time values',
subtitle:'={{$parameter["action"]}}',
defaults:{
name:'Date & Time',
color:'#408000',
},
inputs:['main'],
outputs:['main'],
properties:[
{
displayName:
"More powerful date functionality is available in <a href='https://docs.n8n.io/code-examples/expressions/luxon/' target='_blank'>expressions</a>,</br> e.g. <code>{{ $now.plus(1, 'week') }}</code>",
name:'noticeDateTime',
type:'notice',
default:'',
},
{
displayName:'Action',
name:'action',
type:'options',
options:[
{
name:'Calculate a Date',
description:'Add or subtract time from a date',
value:'calculate',
action:'Add or subtract time from a date',
},
{
name:'Format a Date',
description:'Convert a date to a different format',
value:'format',
action:'Convert a date to a different format',
},
],
default:'format',
},
{
displayName:'Value',
name:'value',
displayOptions:{
show:{
action:['format'],
},
},
type:'string',
default:'',
description:'The value that should be converted',
required: true,
},
{
displayName:'Property Name',
name:'dataPropertyName',
type:'string',
default:'data',
required: true,
displayOptions:{
show:{
action:['format'],
},
},
description:'Name of the property to which to write the converted date',
},
{
displayName:'Custom Format',
name:'custom',
displayOptions:{
show:{
action:['format'],
},
},
type:'boolean',
default:false,
description:'Whether a predefined format should be selected or custom format entered',
description:'In case the input format is not recognized you can provide the format',
},
{
displayName:'From Timezone Name or ID',
name:'fromTimezone',
type:'options',
typeOptions:{
loadOptionsMethod:'getTimezones',
},
default:'UTC',
description:
'The timezone to convert from. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName:'To Timezone Name or ID',
name:'toTimezone',
type:'options',
typeOptions:{
loadOptionsMethod:'getTimezones',
},
default:'UTC',
description:
'The timezone to convert to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
],
},
{
displayName:'Date Value',
name:'value',
displayOptions:{
show:{
action:['calculate'],
},
},
type:'string',
default:'',
description:'The date string or timestamp from which you want to add/subtract time',
required: true,
},
{
displayName:'Operation',
name:'operation',
displayOptions:{
show:{
action:['calculate'],
},
},
type:'options',
noDataExpression: true,
options:[
{
name:'Add',
value:'add',
description:'Add time to Date Value',
action:'Add time to Date Value',
},
{
name:'Subtract',
value:'subtract',
description:'Subtract time from Date Value',
action:'Subtract time from Date Value',
},
],
default:'add',
required: true,
},
{
displayName:'Duration',
name:'duration',
displayOptions:{
show:{
action:['calculate'],
},
},
type:'number',
typeOptions:{
minValue: 0,
},
default:0,
required: true,
description:'E.g. enter “10” then select “Days” if you want to add 10 days to Date Value.',
},
{
displayName:'Time Unit',
name:'timeUnit',
description:'Time unit for Duration parameter above',
'Format for parsing the value as a date. If unrecognized, specify the <a href="https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.datetime/#faqs">format</a> for the value.',