{"ScriptPreparationCode":"// php date(locutus.io)\r\nconst pattern1 = /\\\\?(.?)/gi;\r\n// dayjs pattern\r\nconst pattern2 = /\\[([^\\]]\u002B)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;\r\n// momentjs pattern\r\nconst pattern3 = /(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g\r\n// php date optimization\r\nconst pattern4 = /\\[([^\\]]\u002B)]|Y|m|d|h|i|s|T/g;\r\n\r\nfunction test1(str) {\r\n return str.match(pattern1);\r\n}\r\n\r\nfunction test2(str) {\r\n // dayjs\r\n return str.match(pattern2);\r\n}\r\n\r\nfunction test3(str) {\r\n // momentjs\r\n return str.match(pattern3);\r\n}\r\n\r\nfunction test4(str) {\r\n return str.match(pattern4);\r\n}\r\n\r\nfunction getReplacement() {\r\n return {\r\n Y: \u00271111\u0027,\r\n m: \u002722\u0027,\r\n d: \u002733\u0027,\r\n h: \u002744\u0027,\r\n i: \u002755\u0027,\r\n s: \u002766\u0027,\r\n T: \u0027UTC\u0027,\r\n }\r\n}\r\n\r\nfunction reaplce1(str) {\r\n const replacement = {\r\n Y: \u00271111\u0027,\r\n m: \u002722\u0027,\r\n d: \u002733\u0027,\r\n h: \u002744\u0027,\r\n i: \u002755\u0027,\r\n s: \u002766\u0027,\r\n T: \u0027UTC\u0027,\r\n };\r\n return str.replace(pattern1, (_, $1) =\u003E replacement[$1] || $1);\r\n}\r\n\r\nfunction reaplce1_1(str) {\r\n const replacement = {\r\n Y: () =\u003E \u00271111\u0027,\r\n m: () =\u003E \u002722\u0027,\r\n d: () =\u003E \u002733\u0027,\r\n h: () =\u003E \u002744\u0027,\r\n i: () =\u003E \u002755\u0027,\r\n s: () =\u003E \u002766\u0027,\r\n T: () =\u003E \u0027UTC\u0027,\r\n };\r\n return str.replace(pattern1, (_, $1) =\u003E replacement[$1] ? replacement[$1]() : $1);\r\n}\r\n\r\nfunction reaplce1_2(str) {\r\n const replacement = {\r\n Y: () =\u003E \u00271111\u0027,\r\n m: \u002722\u0027,\r\n d: () =\u003E \u002733\u0027,\r\n h: \u002744\u0027,\r\n i: () =\u003E \u002755\u0027,\r\n s: \u002766\u0027,\r\n T: () =\u003E \u0027UTC\u0027,\r\n };\r\n return str.replace(pattern1, (_, $1) =\u003E {\r\n if (replacement[$1]) {\r\n return typeof replacement[$1] === \u0027function\u0027 ? replacement[$1]() : replacement[$1] || $1;\r\n }\r\n return $1;\r\n });\r\n}\r\n\r\nfunction reaplce1_3(str) {\r\n const replacement = getReplacement();\r\n return str.replace(pattern1, (_, $1) =\u003E replacement[$1] || $1);\r\n}\r\n\r\nfunction reaplce2(str) {\r\n const replacement = {\r\n YYYY: \u00271111\u0027,\r\n MM: \u002722\u0027,\r\n DD: \u002733\u0027,\r\n HH: \u002744\u0027,\r\n mm: \u002755\u0027,\r\n ss: \u002766\u0027,\r\n Z: \u0027\u002B08:00\u0027,\r\n };\r\n return str.replace(pattern2, ($0) =\u003E replacement[$0] || $0);\r\n}\r\n\r\nfunction getReplacement2() {\r\n return {\r\n YYYY: \u00271111\u0027,\r\n MM: \u002722\u0027,\r\n DD: \u002733\u0027,\r\n HH: \u002744\u0027,\r\n mm: \u002755\u0027,\r\n ss: \u002766\u0027,\r\n Z: \u0027\u002B08:00\u0027,\r\n }\r\n}\r\n\r\nfunction reaplce2_3(str) {\r\n const replacement = getReplacement2();\r\n return str.replace(pattern2, ($0) =\u003E replacement[$0] || $0);\r\n}\r\n\r\nfunction replace4(str) {\r\n const replacement = {\r\n Y: \u00271111\u0027,\r\n m: \u002722\u0027,\r\n d: \u002733\u0027,\r\n h: \u002744\u0027,\r\n i: \u002755\u0027,\r\n s: \u002766\u0027,\r\n T: \u0027UTC\u0027,\r\n };\r\n return str.replace(pattern4, ($0) =\u003E replacement[$0] || $0);\r\n}\r\n\r\nfunction replace4_3(str) {\r\n const replacement = getReplacement();\r\n return str.replace(pattern4, ($0) =\u003E replacement[$0] || $0);\r\n}\r\n","TestCases":[{"Name":"test1: php date(locutus.io)","Code":"test1(\u0027Y-m-d h:i:s T\u0027);","IsDeferred":false},{"Name":"test2: dayjs pattern","Code":"test2(\u0027YYYY-MM-DD HH:mm:ss Z\u0027);","IsDeferred":false},{"Name":"test3: momentjs pattern","Code":"test3(\u0027YYYY-MM-DD HH:mm:ss Z\u0027);","IsDeferred":false},{"Name":"reaplce1","Code":"reaplce1(\u0027Y-m-d h:i:s T\u0027);","IsDeferred":false},{"Name":"reaplce1_1","Code":"reaplce1_1(\u0027Y-m-d h:i:s T\u0027);","IsDeferred":false},{"Name":"reaplce1_2","Code":"reaplce1_2(\u0027Y-m-d h:i:s T\u0027);","IsDeferred":false},{"Name":"reaplce1_3","Code":"reaplce1_3(\u0027Y-m-d h:i:s T\u0027)","IsDeferred":false},{"Name":"reaplce2","Code":"reaplce2(\u0027YYYY-MM-DD HH:mm:ss Z\u0027);","IsDeferred":false},{"Name":"reaplce2_3","Code":"reaplce2_3(\u0027YYYY-MM-DD HH:mm:ss Z\u0027);","IsDeferred":false},{"Name":"test4: php date optimization","Code":"test4(\u0027Y-m-d h:i:s T\u0027);","IsDeferred":false},{"Name":"replace4","Code":"replace4(\u0027Y-m-d h:i:s T\u0027)","IsDeferred":false},{"Name":"replace4_3","Code":"replace4_3(\u0027Y-m-d h:i:s T\u0027)","IsDeferred":false}]}