{"updatedAt":"2025-12-02T20:44:19.000Z","createdAt":"2025-11-13T12:59:42.586Z","id":"hhOpwpRVKukcnT2U","name":"ISO TO NOTION","active":true,"isArchived":false,"nodes":[{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/pages/{{ $('When Executed by Another Workflow').item.json.NotionPageID }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"properties\": {\n    \"actual time\": {\n      \"date\": {\n        \"start\": \"{{ $('When Executed by Another Workflow').item.json.ISOSTART }}\",\n        \"end\": \"{{ $('When Executed by Another Workflow').item.json.ISOEND }}\",\n        \"time_zone\": \"Asia/Jerusalem\"\n      }\n    }\n  }\n}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[992,-736],"id":"b4b76200-6895-4385-84d1-f30902a07756","name":"apend file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"jsCode":"// Take the datetime from the previous node\n// Replace property_time with your actual field name\nconst input = \"2025-11-20T17:30:00\";\n\nconst dt = new Date(input);\n\n// Extract timezone string like: \"3:30:00 PM GMT+02\" / \"GMT+3\" / \"UTC+03\" etc.\nconst offsetString = dt.toLocaleTimeString(\"en-US\", {\n  timeZone: \"Asia/Jerusalem\",\n  timeZoneName: \"shortOffset\"\n});\n\n// Universal regex that matches +02, +2, +03, +3, :00 etc.\nconst match = offsetString.match(/([+\\-]\\d{1,2})(:?(\\d{2}))?/);\n\nif (!match) {\n  throw new Error(\"Could not extract timezone offset from: \" + offsetString);\n}\n\n// match[1] = hours (+2, +03, etc.)\nlet hours = match[1].replace(\"+\", \"\");   // remove \"+\"\nif (hours.length === 1) hours = \"0\" + hours;\n\n// match[3] = minutes (usually undefined)\nlet minutes = match[3] || \"00\";\n\n// Final offset — exactly what you want (\"02:00\" or \"03:00\")\nconst offset = `${hours}:${minutes}`;\n\nreturn [{ json: { offset } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1008,-288],"id":"092d740e-a751-43b3-9ed1-b3dd6ab574b1","name":"Code in JavaScript"},{"parameters":{"workflowId":{"__rl":true,"value":"Dy2aUzdCa7kdZl4W","mode":"list","cachedResultUrl":"/workflow/Dy2aUzdCa7kdZl4W","cachedResultName":"ISO Offset Calac"},"workflowInputs":{"mappingMode":"defineBelow","value":{"ISO Time":"={{ $json.ISOSTART }}"},"matchingColumns":["ISO Time"],"schema":[{"id":"ISO Time","displayName":"ISO Time","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[288,-736],"id":"37a9db3c-bc8f-4851-b826-1de90d57e620","name":"Call 'ISO Offset Calac'"},{"parameters":{"workflowInputs":{"values":[{"name":"NotionPageID"},{"name":"ISOSTART"},{"name":"ISOEND"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[-128,-736],"id":"31ee04f2-127f-415d-8329-a9d67b713063","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"// Input variables from previous node\nconst isoStart = $('When Executed by Another Workflow').first().json.ISOSTART;   // e.g. \"2025-11-13T14:50:00\"\nconst isoEnd   = $('When Executed by Another Workflow').first().json.ISOEND;     // e.g. \"2025-11-13T15:30:00\"\nconst offset   = $input.first().json.offset;     // e.g. \"02:00\" or \"03:00\"\n\n// Parse offset into hours + minutes\nconst [offHoursStr, offMinutesStr] = offset.split(':');\nconst offHours = parseInt(offHoursStr, 10);\nconst offMinutes = parseInt(offMinutesStr, 10);\n\n// Function that applies offset correctly\nfunction applyOffset(isoString) {\n    const date = new Date(isoString);   // Converts this into a Date object (UTC mode)\n\n    // Add hours\n    date.setHours(date.getHours() + offHours);\n\n    // Add minutes\n    date.setMinutes(date.getMinutes() + offMinutes);\n\n    // Convert back to ISO without milliseconds and WITHOUT timezone offset\n    const fixed = date.toISOString().replace(/\\.\\d+Z$/, \"\");\n    return fixed;\n}\n\nreturn [\n  {\n    json: {\n      newStart: applyOffset(isoStart),\n      newEnd: applyOffset(isoEnd),\n    }\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,-736],"id":"8d476623-e147-41df-8657-d0907acd2846","name":"Code in JavaScript1"}],"connections":{"Code in JavaScript":{"main":[[]]},"Call 'ISO Offset Calac'":{"main":[[{"node":"Code in JavaScript1","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Call 'ISO Offset Calac'","type":"main","index":0}]]},"Code in JavaScript1":{"main":[[{"node":"apend file","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{"When Executed by Another Workflow":[{"json":{"NotionPageID":"2bddcbfd-8835-8172-94fa-cf6aa47db6fd","ISOSTART":"2025-12-01T04:38","ISOEND":"2025-12-02T22:38"}}]},"versionId":"3ffe1906-d16e-49bf-8e42-25bff933e19c","activeVersionId":"3ffe1906-d16e-49bf-8e42-25bff933e19c","triggerCount":0,"shared":[{"updatedAt":"2025-11-13T12:59:42.589Z","createdAt":"2025-11-13T12:59:42.589Z","role":"workflow:owner","workflowId":"hhOpwpRVKukcnT2U","projectId":"lh2csO3ZG7MzpN8o"}],"activeVersion":{"updatedAt":"2025-12-02T20:44:19.543Z","createdAt":"2025-12-02T20:44:19.543Z","versionId":"3ffe1906-d16e-49bf-8e42-25bff933e19c","workflowId":"hhOpwpRVKukcnT2U","nodes":[{"parameters":{"method":"PATCH","url":"=https://api.notion.com/v1/pages/{{ $('When Executed by Another Workflow').item.json.NotionPageID }}","authentication":"predefinedCredentialType","nodeCredentialType":"notionApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Notion-Version","value":"2025-09-03"},{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"contentType":"raw","rawContentType":"application/json","body":"={\n  \"properties\": {\n    \"actual time\": {\n      \"date\": {\n        \"start\": \"{{ $('When Executed by Another Workflow').item.json.ISOSTART }}\",\n        \"end\": \"{{ $('When Executed by Another Workflow').item.json.ISOEND }}\",\n        \"time_zone\": \"Asia/Jerusalem\"\n      }\n    }\n  }\n}","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.3,"position":[992,-736],"id":"b4b76200-6895-4385-84d1-f30902a07756","name":"apend file","credentials":{"notionApi":{"id":"j9X7YFSp6m90N06v","name":"Notion account"}}},{"parameters":{"jsCode":"// Take the datetime from the previous node\n// Replace property_time with your actual field name\nconst input = \"2025-11-20T17:30:00\";\n\nconst dt = new Date(input);\n\n// Extract timezone string like: \"3:30:00 PM GMT+02\" / \"GMT+3\" / \"UTC+03\" etc.\nconst offsetString = dt.toLocaleTimeString(\"en-US\", {\n  timeZone: \"Asia/Jerusalem\",\n  timeZoneName: \"shortOffset\"\n});\n\n// Universal regex that matches +02, +2, +03, +3, :00 etc.\nconst match = offsetString.match(/([+\\-]\\d{1,2})(:?(\\d{2}))?/);\n\nif (!match) {\n  throw new Error(\"Could not extract timezone offset from: \" + offsetString);\n}\n\n// match[1] = hours (+2, +03, etc.)\nlet hours = match[1].replace(\"+\", \"\");   // remove \"+\"\nif (hours.length === 1) hours = \"0\" + hours;\n\n// match[3] = minutes (usually undefined)\nlet minutes = match[3] || \"00\";\n\n// Final offset — exactly what you want (\"02:00\" or \"03:00\")\nconst offset = `${hours}:${minutes}`;\n\nreturn [{ json: { offset } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1008,-288],"id":"092d740e-a751-43b3-9ed1-b3dd6ab574b1","name":"Code in JavaScript"},{"parameters":{"workflowId":{"__rl":true,"value":"Dy2aUzdCa7kdZl4W","mode":"list","cachedResultUrl":"/workflow/Dy2aUzdCa7kdZl4W","cachedResultName":"ISO Offset Calac"},"workflowInputs":{"mappingMode":"defineBelow","value":{"ISO Time":"={{ $json.ISOSTART }}"},"matchingColumns":["ISO Time"],"schema":[{"id":"ISO Time","displayName":"ISO Time","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string","removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.3,"position":[288,-736],"id":"37a9db3c-bc8f-4851-b826-1de90d57e620","name":"Call 'ISO Offset Calac'"},{"parameters":{"workflowInputs":{"values":[{"name":"NotionPageID"},{"name":"ISOSTART"},{"name":"ISOEND"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[-128,-736],"id":"31ee04f2-127f-415d-8329-a9d67b713063","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"// Input variables from previous node\nconst isoStart = $('When Executed by Another Workflow').first().json.ISOSTART;   // e.g. \"2025-11-13T14:50:00\"\nconst isoEnd   = $('When Executed by Another Workflow').first().json.ISOEND;     // e.g. \"2025-11-13T15:30:00\"\nconst offset   = $input.first().json.offset;     // e.g. \"02:00\" or \"03:00\"\n\n// Parse offset into hours + minutes\nconst [offHoursStr, offMinutesStr] = offset.split(':');\nconst offHours = parseInt(offHoursStr, 10);\nconst offMinutes = parseInt(offMinutesStr, 10);\n\n// Function that applies offset correctly\nfunction applyOffset(isoString) {\n    const date = new Date(isoString);   // Converts this into a Date object (UTC mode)\n\n    // Add hours\n    date.setHours(date.getHours() + offHours);\n\n    // Add minutes\n    date.setMinutes(date.getMinutes() + offMinutes);\n\n    // Convert back to ISO without milliseconds and WITHOUT timezone offset\n    const fixed = date.toISOString().replace(/\\.\\d+Z$/, \"\");\n    return fixed;\n}\n\nreturn [\n  {\n    json: {\n      newStart: applyOffset(isoStart),\n      newEnd: applyOffset(isoEnd),\n    }\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,-736],"id":"8d476623-e147-41df-8657-d0907acd2846","name":"Code in JavaScript1"}],"connections":{"Code in JavaScript":{"main":[[]]},"Call 'ISO Offset Calac'":{"main":[[{"node":"Code in JavaScript1","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Call 'ISO Offset Calac'","type":"main","index":0}]]},"Code in JavaScript1":{"main":[[{"node":"apend file","type":"main","index":0}]]}},"authors":"Ben Hex","name":null,"description":null,"autosaved":false},"tags":[]}