{
  "name": "Flowprep · Normalize UTC dates",
  "active": false,
  "nodes": [
    {
      "id": "normalize-utc-dates-start",
      "name": "Start manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        300
      ],
      "parameters": {}
    },
    {
      "id": "normalize-utc-dates-sample",
      "name": "Sample data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        260,
        300
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    \"date\": \"2028-02-29T10:00:00Z\",\n    \"title\": \"Leap day\"\n  },\n  {\n    \"date\": \"not-a-date\",\n    \"title\": \"Review this row\"\n  }\n].map(json => ({ json }));"
      }
    },
    {
      "id": "normalize-utc-dates-transform",
      "name": "Normalize UTC dates",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        300
      ],
      "parameters": {
        "jsCode": "return $input.all().map((item, i) => {\n  const raw = item.json.date;\n  const parsed = typeof raw === 'string' && raw.trim() ? new Date(raw) : new Date(NaN);\n  const validDate = Number.isFinite(parsed.getTime());\n  return { json: { ...item.json, isoDate: validDate ? parsed.toISOString() : null, validDate }, pairedItem: { item: i } };\n});"
      }
    },
    {
      "id": "normalize-utc-dates-note",
      "name": "Read first",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -30
      ],
      "parameters": {
        "content": "## Normalize UTC dates\nConvert valid timestamps to ISO strings and mark invalid inputs.\n\n1. Import into n8n.\n2. Execute manually and inspect the output.\n3. Replace Sample data with your source after reviewing the Code node.\n\nPrefer ISO timestamps with an explicit offset. Ambiguous input strings use JavaScript date parsing and may not match local business dates.\n\nIndependent example from Flowprep. No credentials or external calls. Sample transformation tested; verify import and execution on your n8n version.",
        "width": 760,
        "height": 230
      }
    }
  ],
  "connections": {
    "Start manually": {
      "main": [
        [
          {
            "node": "Sample data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sample data": {
      "main": [
        [
          {
            "node": "Normalize UTC dates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "tags": []
}