{ "kind": "open-flow-workflow", "version": 1, "name": "Get Current Local Datetime", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_c1bd7daf23def4e0": { "name": "Enter time zone", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "timezone" } ] }, "n_15c364855fb12b8e": { "inputs": { "timezone": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c1bd7daf23def4e0", "output": "timezone" } ] } }, "name": "Get local datetime", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "timezone" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "utc" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "year" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "month" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "day" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "hour" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "minute" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "second" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "millisecond" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "formatted" } ], "name": "Get local datetime", "moduleId": "n_4999e56d2427712a", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_46fd53c568d27211": { "name": "Date and time", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "utc" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "year" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "month" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "day" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "hour" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "minute" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "second" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "millisecond" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "formatted" } ], "outputMappings": { "utc": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "utc" } ] }, "year": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "year" } ] }, "month": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "month" } ] }, "day": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "day" } ] }, "hour": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "hour" } ] }, "minute": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "minute" } ] }, "second": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "second" } ] }, "millisecond": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "millisecond" } ] }, "formatted": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_15c364855fb12b8e", "output": "formatted" } ] } } } }, "edges": [ { "source": "n_c1bd7daf23def4e0", "target": "n_15c364855fb12b8e" }, { "source": "n_15c364855fb12b8e", "target": "n_46fd53c568d27211" } ] } }, "modules": { "n_4999e56d2427712a": { "name": "Get local datetime", "imports": [], "source": "export default function localDatetime({timezone}) {\n const date = new Date();\n const parts = Object.fromEntries(new Intl.DateTimeFormat('en-GB', {timeZone: timezone, year:'numeric', month:'2-digit', day:'2-digit', hour:'2-digit', minute:'2-digit', second:'2-digit', hourCycle:'h23', timeZoneName:'longOffset'}).formatToParts(date).map(({type,value})=>[type,value]));\n const ms = String(date.getUTCMilliseconds()).padStart(3,'0');\n const offset = parts.timeZoneName === 'GMT' ? '+00:00' : parts.timeZoneName.replace('GMT','');\n return {utc:date.toISOString(),year:+parts.year,month:+parts.month-1,day:+parts.day,hour:+parts.hour,minute:+parts.minute,second:+parts.second,millisecond:+ms,formatted:`${parts.year}-${parts.month}-${parts.day} ${parts.hour}:${parts.minute}:${parts.second}.${ms} ${offset}`};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }