From c2b592eea802e66a52dc7093e8989f4e99f07810 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 17 Mar 2023 05:05:16 +0530 Subject: [PATCH] test: tz offset corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- tests/playwright/setup/xcdb-records.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/playwright/setup/xcdb-records.ts b/tests/playwright/setup/xcdb-records.ts index b155554d30..c97fa1fc2e 100644 --- a/tests/playwright/setup/xcdb-records.ts +++ b/tests/playwright/setup/xcdb-records.ts @@ -36,21 +36,29 @@ const rowMixedValue = (column: ColumnType, index: number) => { null, ]; + // compute timezone offset + const offset = new Date().getTimezoneOffset(); + const timezoneOffset = + (offset < 0 ? '+' : '-') + + String(Math.abs(Math.round(offset / 60))).padStart(2, '0') + + ':' + + String(Math.abs(offset % 60)).padStart(2, '0'); + // Array of random integers, not more than 10000 const numbers = [33, null, 456, 333, 267, 34, 8754, 3234, 44, 33, null]; const decimals = [33.3, 456.34, 333.3, null, 267.5674, 34.0, 8754.0, 3234.547, 44.2647, 33.98, null]; const duration = [60, 120, 180, 3600, 3660, 3720, null, 3780, 60, 120, null]; const time = [ - '1999-01-01 02:02:00+08:00', - '1999-01-01 20:20:20+08:00', - '1999-01-01 04:04:00+08:00', - '1999-01-01 02:02:00+08:00', - '1999-01-01 20:20:20+08:00', - '1999-01-01 18:18:18+08:00', + `1999-01-01 02:02:00${timezoneOffset}`, + `1999-01-01 20:20:20${timezoneOffset}`, + `1999-01-01 04:04:00${timezoneOffset}`, + `1999-01-01 02:02:00${timezoneOffset}`, + `1999-01-01 20:20:20${timezoneOffset}`, + `1999-01-01 18:18:18${timezoneOffset}`, null, - '1999-01-01 02:02:00+08:00', - '1999-01-01 20:20:20+08:00', - '1999-01-01 18:18:18+08:00', + `1999-01-01 02:02:00${timezoneOffset}`, + `1999-01-01 20:20:20${timezoneOffset}`, + `1999-01-01 18:18:18${timezoneOffset}`, null, ]; const rating = [0, 1, 2, 3, null, 0, 4, 5, 0, 1, null];