{"updatedAt":"2025-11-13T15:20:01.000Z","createdAt":"2025-11-13T13:41:23.116Z","id":"Dy2aUzdCa7kdZl4W","name":"ISO Offset Calac","active":true,"isArchived":false,"nodes":[{"parameters":{"workflowInputs":{"values":[{"name":"ISO Time"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[0,0],"id":"7ac85011-e850-4d16-9c75-df23526b5c8b","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"// Accepts either:\n// \"2025-01-20T10:00:00\"\n// \"2025-11-13T13:33:00.000Z\"\n// Replace property_time with the correct input field\nlet input = $input.first().json['ISO Time'];\n\n// --- STEP 1: Normalize format ----------------------------------------------\n\n// If input ends with \"Z\" → convert from UTC ISO to your expected format\nif (typeof input === \"string\" && input.endsWith(\"Z\")) {\n\t// Remove milliseconds + trailing Z\n\t// Example: \"2025-11-13T13:33:00.000Z\" → \"2025-11-13T13:33:00\"\n\tinput = input.replace(/\\.\\d{3}Z$/, \"\");\n}\n\n// Now input is always \"YYYY-MM-DDTHH:mm:SS\"\nconst dt = new Date(input);\n\n// --- STEP 2: Extract DST-aware Israel offset --------------------------------\n\nconst offsetString = dt.toLocaleTimeString(\"en-US\", {\n\ttimeZone: \"Asia/Jerusalem\",\n\ttimeZoneName: \"shortOffset\"\n});\n\n// Handles: GMT+2 / GMT+02 / GMT+02:00 / UTC+3 / UTC+03:00 etc.\nconst match = offsetString.match(/([+\\-]\\d{1,2})(:?(\\d{2}))?/);\n\nif (!match) {\n\tthrow new Error(\"Could not extract timezone offset from: \" + offsetString);\n}\n\n// Clean hours: +2 → 02, +03 → 03\nlet hours = match[1].replace(\"+\", \"\"); // remove \"+\"\n\nif (hours.length === 1) {\n\thours = \"0\" + hours;\n}\n\nconst minutes = match[3] || \"00\"; // Israel is always :00\n\n// Final output\nconst offset = `${hours}:${minutes}`;\n\nreturn [{ json: { offset } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"4fdcdbd0-2905-4efd-8049-d8d7cf284987","name":"Code in JavaScript"}],"connections":{"When Executed by Another Workflow":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{"When Executed by Another Workflow":[{"json":{"ISO Time":"2025-11-12T13:46:00"}}]},"versionId":"70391143-7e66-44fe-9588-6dd40f579f1d","activeVersionId":"70391143-7e66-44fe-9588-6dd40f579f1d","triggerCount":0,"shared":[{"updatedAt":"2025-11-13T13:41:23.118Z","createdAt":"2025-11-13T13:41:23.118Z","role":"workflow:owner","workflowId":"Dy2aUzdCa7kdZl4W","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-11-27T21:37:34.259Z","createdAt":"2025-11-27T21:37:34.259Z","versionId":"70391143-7e66-44fe-9588-6dd40f579f1d","workflowId":"Dy2aUzdCa7kdZl4W","nodes":[{"parameters":{"workflowInputs":{"values":[{"name":"ISO Time"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[0,0],"id":"7ac85011-e850-4d16-9c75-df23526b5c8b","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"// Accepts either:\n// \"2025-01-20T10:00:00\"\n// \"2025-11-13T13:33:00.000Z\"\n// Replace property_time with the correct input field\nlet input = $input.first().json['ISO Time'];\n\n// --- STEP 1: Normalize format ----------------------------------------------\n\n// If input ends with \"Z\" → convert from UTC ISO to your expected format\nif (typeof input === \"string\" && input.endsWith(\"Z\")) {\n\t// Remove milliseconds + trailing Z\n\t// Example: \"2025-11-13T13:33:00.000Z\" → \"2025-11-13T13:33:00\"\n\tinput = input.replace(/\\.\\d{3}Z$/, \"\");\n}\n\n// Now input is always \"YYYY-MM-DDTHH:mm:SS\"\nconst dt = new Date(input);\n\n// --- STEP 2: Extract DST-aware Israel offset --------------------------------\n\nconst offsetString = dt.toLocaleTimeString(\"en-US\", {\n\ttimeZone: \"Asia/Jerusalem\",\n\ttimeZoneName: \"shortOffset\"\n});\n\n// Handles: GMT+2 / GMT+02 / GMT+02:00 / UTC+3 / UTC+03:00 etc.\nconst match = offsetString.match(/([+\\-]\\d{1,2})(:?(\\d{2}))?/);\n\nif (!match) {\n\tthrow new Error(\"Could not extract timezone offset from: \" + offsetString);\n}\n\n// Clean hours: +2 → 02, +03 → 03\nlet hours = match[1].replace(\"+\", \"\"); // remove \"+\"\n\nif (hours.length === 1) {\n\thours = \"0\" + hours;\n}\n\nconst minutes = match[3] || \"00\"; // Israel is always :00\n\n// Final output\nconst offset = `${hours}:${minutes}`;\n\nreturn [{ json: { offset } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[208,0],"id":"4fdcdbd0-2905-4efd-8049-d8d7cf284987","name":"Code in JavaScript"}],"connections":{"When Executed by Another Workflow":{"main":[[{"node":"Code in JavaScript","type":"main","index":0}]]}},"authors":"system migration","name":null,"description":null,"autosaved":false},"tags":[]}