From 1b66dd47b485ffb93e8681821fdd98ee73765dd9 Mon Sep 17 00:00:00 2001 From: Jonny Power Date: Sat, 22 Jul 2023 10:34:57 -0700 Subject: [PATCH 1/2] fix(junit): fix locale sensitivity with junit closes #323 --- src/utils/dateUtil.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/dateUtil.ts b/src/utils/dateUtil.ts index bc2ae3c5..2310de48 100644 --- a/src/utils/dateUtil.ts +++ b/src/utils/dateUtil.ts @@ -14,11 +14,11 @@ export function getCurrentTime(): number { /** * Returns the formatted date and time given the milliseconds in numbers or UTC formatted string * @param startTime start time in millisecond numbers or UTC format string - * @returns date and time formatted for locale + * @returns date as ISO string */ export function formatStartTime(startTime: string | number): string { const date = new Date(startTime); - return `${date.toDateString()} ${date.toLocaleTimeString()}`; + return `${date.toISOString()}`; } export function msToSecond(timestamp: string | number): string { From 529866de42dd5ce10e0b650406a7e2bf2509ac6c Mon Sep 17 00:00:00 2001 From: Jonny Power Date: Sat, 22 Jul 2023 15:50:57 -0700 Subject: [PATCH 2/2] fix(test): iso in js tests closes #323 --- test/reporters/testResults.ts | 2 +- test/tests/testData.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/reporters/testResults.ts b/test/reporters/testResults.ts index d7182844..e45d74f3 100644 --- a/test/reporters/testResults.ts +++ b/test/reporters/testResults.ts @@ -10,7 +10,7 @@ import { ApexTestResultOutcome, TestResult } from '../../src/tests/types'; const testStartTime = '2020-11-09T18:02:50.000+0000'; const date = new Date(testStartTime); -const localStartTime = `${date.toDateString()} ${date.toLocaleTimeString()}`; +const localStartTime = `${date.toISOString()}`; export const coverageResult: TestResult = { summary: { diff --git a/test/tests/testData.ts b/test/tests/testData.ts index 6b0132b2..8e0ab58b 100644 --- a/test/tests/testData.ts +++ b/test/tests/testData.ts @@ -91,7 +91,7 @@ export const syncTestResultWithFailures: SyncTestResult = { export const testStartTime = '2020-11-09T18:02:50.000+0000'; const date = new Date(testStartTime); -const localStartTime = `${date.toDateString()} ${date.toLocaleTimeString()}`; +const localStartTime = `${date.toISOString()}`; export const testRunId = '707xx0000AGQ3jbQQD'; export const syncResult: TestResult = {