{"ScriptPreparationCode":null,"TestCases":[{"Name":"own","Code":"const d = new Date(\u002710/10/2018\u0027);\r\n/**\r\n * This is a hack\r\n */\r\nconst milliseconds = \u0027\u0027;\r\nconst seconds = 1000;\r\nconst minutes = 60 * seconds;\r\nconst hours = 60 * minutes;\r\nconst days = 24 * hours;\r\n\r\nconst granularities = {\r\n milliseconds,\r\n seconds,\r\n minutes,\r\n hours,\r\n days,\r\n};\r\n\r\nfunction compare(first, second, granularity = \u0027milliseconds\u0027) {\r\n const accuracy = granularities[granularity].toString().length;\r\n const [a, b] = [first, second].map(date =\u003E\r\n (date instanceof Date ? date.getTime() : date).toString(),\r\n );\r\n\r\n return (\r\n \u002Ba.substring(0, a.length - accuracy) - \u002Bb.substring(0, b.length - accuracy)\r\n );\r\n};\r\n\r\n\r\ncompare(d, new Date()) \u003C= 0","IsDeferred":false},{"Name":"moment","Code":"const d = new Date(\u002710/10/2018\u0027);\r\n\r\nmoment(d).isBefore(new Date())","IsDeferred":false}]}