n8n-nodes-mautic-advanced 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -95,6 +95,14 @@ exports.mauticApiRequestAllItems = mauticApiRequestAllItems;
95
95
  */
96
96
  function serialiseMauticWhere(whereArray, prefix = 'where') {
97
97
  const params = {};
98
+ const dateFields = [
99
+ 'date_modified',
100
+ 'date_added',
101
+ 'last_active',
102
+ 'date_identified',
103
+ 'dateFrom',
104
+ 'dateTo',
105
+ ];
98
106
  whereArray.forEach((condition, idx) => {
99
107
  const base = `${prefix}[${idx}]`;
100
108
  if (condition.expr === 'andX' || condition.expr === 'orX') {
@@ -116,8 +124,22 @@ function serialiseMauticWhere(whereArray, prefix = 'where') {
116
124
  params[`${base}[col]`] = condition.col;
117
125
  if (condition.expr)
118
126
  params[`${base}[expr]`] = condition.expr;
119
- if (condition.val !== undefined && condition.val !== '')
120
- params[`${base}[val]`] = condition.val;
127
+ if (condition.val !== undefined && condition.val !== '') {
128
+ let val = condition.val;
129
+ // Auto-format date values for known date fields
130
+ if (condition.col &&
131
+ dateFields.includes(condition.col) &&
132
+ typeof val === 'string' &&
133
+ (val.includes('T') || val.match(/^\d{4}-\d{2}-\d{2}/))) {
134
+ // Try to parse and format as UTC 'YYYY-MM-DD HH:mm:ss'
135
+ const d = new Date(val);
136
+ if (!isNaN(d.getTime())) {
137
+ const pad = (n) => n.toString().padStart(2, '0');
138
+ val = `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`;
139
+ }
140
+ }
141
+ params[`${base}[val]`] = val;
142
+ }
121
143
  }
122
144
  });
123
145
  return params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-mautic-advanced",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Enhanced n8n node for Mautic with comprehensive API coverage including tags, campaigns, categories, and advanced contact management",
5
5
  "keywords": [
6
6
  "n8n",