2023-04-05 07:47:44 -07:00
import type { INodeProperties } from 'n8n-workflow' ;
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-examples/expressions/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' ,
2023-04-05 07:53:36 -07:00
name : 'format' ,
2023-04-05 07:47:44 -07:00
type : 'options' ,
displayOptions : {
show : {
2023-04-05 07:53:36 -07:00
operation : [ 'formatDate' ] ,
2023-04-05 07:47:44 -07:00
} ,
} ,
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options : [
{
name : 'Custom Format' ,
value : 'custom' ,
} ,
{
name : 'MM/DD/YYYY' ,
2023-04-11 04:10:52 -07:00
value : 'MM/dd/yyyy' ,
2023-04-05 07:47:44 -07:00
description : 'Example: 09/04/1986' ,
} ,
{
name : 'YYYY/MM/DD' ,
2023-04-11 04:10:52 -07:00
value : 'yyyy/MM/dd' ,
2023-04-05 07:47:44 -07:00
description : 'Example: 1986/04/09' ,
} ,
{
name : 'MMMM DD YYYY' ,
2023-04-11 04:10:52 -07:00
value : 'MMMM dd yyyy' ,
2023-04-05 07:47:44 -07:00
description : 'Example: April 09 1986' ,
} ,
{
name : 'MM-DD-YYYY' ,
2023-04-11 04:10:52 -07:00
value : 'MM-dd-yyyy' ,
2023-04-05 07:47:44 -07:00
description : 'Example: 09-04-1986' ,
} ,
{
name : 'YYYY-MM-DD' ,
2023-04-11 04:10:52 -07:00
value : 'yyyy-MM-dd' ,
2023-04-05 07:47:44 -07:00
description : 'Example: 1986-04-09' ,
} ,
{
name : 'Unix Timestamp' ,
value : 'X' ,
description : 'Example: 513388800.879' ,
} ,
{
name : 'Unix Ms Timestamp' ,
value : 'x' ,
description : 'Example: 513388800' ,
} ,
] ,
2023-04-11 04:10:52 -07:00
default : 'mm/dd/yyyy' ,
2023-04-05 07:47:44 -07:00
description : 'The format to convert the date to' ,
} ,
{
displayName : 'Custom Format' ,
name : 'customFormat' ,
type : 'string' ,
displayOptions : {
show : {
format : [ 'custom' ] ,
} ,
} ,
hint : 'List of special tokens <a target="_blank" href="https://moment.github.io/luxon/#/formatting?id=table-of-tokens">More info</a>' ,
2023-04-05 08:25:27 -07:00
default : '' ,
placeholder : 'yyyy-MM-dd' ,
2023-04-05 07:47:44 -07:00
} ,
{
displayName : 'Output Field Name' ,
name : 'outputFieldName' ,
type : 'string' ,
default : 'formattedDate' ,
description : 'Name of the field to put the output in' ,
displayOptions : {
show : {
operation : [ 'formatDate' ] ,
} ,
} ,
} ,
] ;