{ "kind": "open-flow-workflow", "version": 1, "name": "Explore Date and Time Calculations", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_6fbc57b43c4373d2": { "name": "Run examples", "kind": "start", "inputDefs": [] }, "n_ce6efbebcce5946b": { "inputs": {}, "name": "Calculate and format dates", "kind": "task", "task": { "inputs": [], "outputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "examples" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "edited" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "dateTimeBranch" } ], "name": "Calculate and format dates", "moduleId": "n_99d8e9d210728e55", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_80ca47f68471e8ce": { "name": "Date examples", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "examples" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "edited" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "dateTimeBranch" } ], "outputMappings": { "examples": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ce6efbebcce5946b", "output": "examples" } ] }, "edited": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ce6efbebcce5946b", "output": "edited" } ] }, "dateTimeBranch": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ce6efbebcce5946b", "output": "dateTimeBranch" } ] } } } }, "edges": [ { "source": "n_6fbc57b43c4373d2", "target": "n_ce6efbebcce5946b" }, { "source": "n_ce6efbebcce5946b", "target": "n_80ca47f68471e8ce" } ] } }, "modules": { "n_99d8e9d210728e55": { "name": "Calculate and format dates", "imports": [], "source": "export default function dateTimeExamples(){\n const now=new Date(), today=new Date(now.getFullYear(),now.getMonth(),now.getDate()), tomorrow=new Date(today); tomorrow.setDate(tomorrow.getDate()+1);\n const pad=n=>String(n).padStart(2,'0');\n const iso=d=>{const off=-d.getTimezoneOffset(),sign=off<0?'-':'+';return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${String(d.getMilliseconds()).padStart(3,'0')}${sign}${pad(Math.floor(Math.abs(off)/60))}:${pad(Math.abs(off)%60)}`};\n const month=new Intl.DateTimeFormat('en-US',{month:'long'}).format(now),shortMonth=new Intl.DateTimeFormat('en-US',{month:'short'}).format(now);\n return {examples:{Now:iso(now),'Current time with seconds':new Intl.DateTimeFormat('en-US',{hour:'numeric',minute:'2-digit',second:'2-digit'}).format(now),Today:iso(today),Tomorrow:iso(tomorrow),'One hour from now':iso(new Date(now.getTime()-3600000)),Weekday:new Intl.DateTimeFormat('en-US',{weekday:'long'}).format(today)},edited:{'Current time':iso(now),'Current time formatted':`${now.getFullYear()} ${shortMonth} ${pad(now.getDate())}`},dateTimeBranch:{twelveHoursAhead:new Date(now.getTime()+12*3600000).toISOString(),date:`${month} ${pad(now.getDate())} ${now.getFullYear()}`}};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }