{"ScriptPreparationCode":"jsDate = new Date()\r\n\r\ndtf = new Intl.DateTimeFormat(\u0022en-US\u0022, {\r\n\thour12: false,\r\n\ttimeZone: \u0022America/New_York\u0022,\r\n\tyear: \u0022numeric\u0022,\r\n\tmonth: \u00222-digit\u0022,\r\n\tday: \u00222-digit\u0022,\r\n\thour: \u00222-digit\u0022,\r\n\tminute: \u00222-digit\u0022,\r\n\tsecond: \u00222-digit\u0022,\r\n\tera: \u0022short\u0022,\r\n})\r\n\r\n// from luxon\r\nfunction hackyOffset(dtf, date) {\r\n\tconst formatted = dtf.format(date).replace(/\\u200E/g, \u0022\u0022),\r\n\t\tparsed = /(\\d\u002B)\\/(\\d\u002B)\\/(\\d\u002B) (AD|BC),? (\\d\u002B):(\\d\u002B):(\\d\u002B)/.exec(formatted),\r\n\t\t[, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed ?? []\r\n\treturn [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond]\r\n}\r\n\r\nconst typeToPos = {\r\n\tyear: 0,\r\n\tmonth: 1,\r\n\tday: 2,\r\n\tera: 3,\r\n\thour: 4,\r\n\tminute: 5,\r\n\tsecond: 6,\r\n}\r\n\r\nfunction partsOffset(dtf, date) {\r\n\tconst formatted = dtf.formatToParts(date)\r\n\tconst filled = new Array(7);\r\n\tfor (let i = 0; i \u003C formatted.length; i\u002B\u002B) {\r\n\t\tconst { type, value } = formatted[i]\r\n\t\tconst pos = typeToPos[type]\r\n\r\n\t\tif (type === \u0022era\u0022) {\r\n\t\t\tfilled[pos] = value\r\n\t\t} else if (pos !== undefined) {\r\n\t\t\tfilled[pos] = parseInt(value, 10)\r\n\t\t}\r\n\t}\r\n\treturn filled\r\n}","TestCases":[{"Name":"hackyOffset","Code":"hackyOffset(dtf, jsDate)","IsDeferred":false},{"Name":"partsOffset","Code":"partsOffset(dtf, jsDate)","IsDeferred":false},{"Name":"dtf.formatToParts","Code":"dtf.formatToParts(jsDate)","IsDeferred":false},{"Name":"dtf.format","Code":"dtf.format(jsDate)","IsDeferred":false}]}