mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-16 01:24:05 -08:00
7d1d1f7872
* Setup versionized node
* Fix node naming
* Set all possible actions
* Add Current Date operation
* Add timezone to current date
* feat add to date operator
* Change output field name to camel case
* Fix info box for luxons tip
* Feat subtract to date operation
* Feat format date operation
* Fix to node field for format date
* Feat rounding operation
* Feat get in between date operation
* Feat add extract date operation
* Add generic function for parsing date
* Remove moment methods from operations
* Change moment to luxon for the rest of the operations
* Fix Format date operation
* Fix format value
* Add timezone option for current date
* Add tests, improve workflow settings for testing, toString the results
* Change icon for V2
* Revert "Change icon for V2"
This reverts commit 46b59bea2e
.
* Change workflow test name
* Fix ui bug for custom format
* Fix default value for format operation
* Fix info box for rounding operation
* Change default for units for between time operation
* Inprove fields and resort time units
* Fix extract week number
* Resolve issue with formating and timezones
* Fix field name and unit order
* ⚡ restored removed test case, sync v1 with curent master
* ⚡ parseDate update to support timestamps, tests
* Keep same field for substract and add time
* Update unit test
* Improve visibility, add iso to string option
* Update option naming
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
106 lines
2 KiB
TypeScript
106 lines
2 KiB
TypeScript
import type { INodeProperties } from 'n8n-workflow';
|
|
|
|
export const SubtractFromDateDescription: INodeProperties[] = [
|
|
{
|
|
displayName:
|
|
"You can also do this using an expression, e.g. <code>{{your_date.minus(5, 'minutes')}}</code>. <a target='_blank' href='https://docs.n8n.io/code-examples/expressions/luxon/'>More info</a>",
|
|
name: 'notice',
|
|
type: 'notice',
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['subtractFromDate'],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
displayName: 'Date to Subtract From',
|
|
name: 'magnitude',
|
|
type: 'string',
|
|
description: 'The date that you want to change',
|
|
default: '',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['subtractFromDate'],
|
|
},
|
|
},
|
|
required: true,
|
|
},
|
|
{
|
|
displayName: 'Time Unit to Subtract',
|
|
name: 'timeUnit',
|
|
description: 'Time unit for Duration parameter below',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['subtractFromDate'],
|
|
},
|
|
},
|
|
type: 'options',
|
|
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
|
|
options: [
|
|
{
|
|
name: 'Years',
|
|
value: 'years',
|
|
},
|
|
{
|
|
name: 'Quarters',
|
|
value: 'quarters',
|
|
},
|
|
{
|
|
name: 'Months',
|
|
value: 'months',
|
|
},
|
|
{
|
|
name: 'Weeks',
|
|
value: 'weeks',
|
|
},
|
|
{
|
|
name: 'Days',
|
|
value: 'days',
|
|
},
|
|
{
|
|
name: 'Hours',
|
|
value: 'hours',
|
|
},
|
|
{
|
|
name: 'Minutes',
|
|
value: 'minutes',
|
|
},
|
|
{
|
|
name: 'Seconds',
|
|
value: 'seconds',
|
|
},
|
|
{
|
|
name: 'Milliseconds',
|
|
value: 'milliseconds',
|
|
},
|
|
],
|
|
default: 'days',
|
|
required: true,
|
|
},
|
|
{
|
|
displayName: 'Duration',
|
|
name: 'duration',
|
|
type: 'number',
|
|
description: 'The number of time units to subtract from the date',
|
|
default: 0,
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['subtractFromDate'],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
displayName: 'Output Field Name',
|
|
name: 'outputFieldName',
|
|
type: 'string',
|
|
default: 'newDate',
|
|
description: 'Name of the field to put the output in',
|
|
displayOptions: {
|
|
show: {
|
|
operation: ['subtractFromDate'],
|
|
},
|
|
},
|
|
},
|
|
];
|