From 5d2dd842cfe1f333e8042c894539525c4b71f153 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 11 May 2023 12:34:24 +0530 Subject: [PATCH] tests: tz correction for pg Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- tests/playwright/tests/db/timezone.spec.ts | 27 ++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/playwright/tests/db/timezone.spec.ts b/tests/playwright/tests/db/timezone.spec.ts index 14c999d52e..028cc0e445 100644 --- a/tests/playwright/tests/db/timezone.spec.ts +++ b/tests/playwright/tests/db/timezone.spec.ts @@ -465,10 +465,15 @@ test.describe('External DB - DateTime column', async () => { const expectedDisplayValues = { pg: { - DatetimeWithoutTz: ['2023-04-27 10:00', '2023-04-27 10:00'], + // PG ignores timezone information for datetime without timezone + DatetimeWithoutTz: [ + getDateTimeInLocalTimeZone('2023-04-27 10:00:00+00:00'), + getDateTimeInLocalTimeZone('2023-04-27 10:00:00+00:00'), + ], + // PG stores datetime with timezone information in UTC DatetimeWithTz: [ getDateTimeInLocalTimeZone('2023-04-27 10:00:00+00:00'), - getDateTimeInLocalTimeZone('2023-04-27 04:30:00+00:00'), + getDateTimeInLocalTimeZone('2023-04-27 10:00:00+05:30'), ], }, sqlite: { @@ -634,11 +639,15 @@ test.describe('External DB - DateTime column', async () => { getDateTimeInUTCTimeZone('2023-04-27 10:00:00+00:00'), ]; } else if (isPg(context)) { - expectedDateTimeWithoutTz = ['2023-04-27 10:00:00', '2023-04-27 10:00:00', '2023-04-27 10:00:00']; + expectedDateTimeWithoutTz = [ + '2023-04-27 10:00:00+00:00', + '2023-04-27 10:00:00+00:00', + getDateTimeInUTCTimeZone('2023-04-27 10:00:00+00:00'), + ]; expectedDateTimeWithTz = [ - '2023-04-27T10:00:00.000Z', - '2023-04-27T04:30:00.000Z', - new Date('2023-04-27T10:00:00').toISOString(), + '2023-04-27 10:00:00+00:00', + '2023-04-27 04:30:00+00:00', + getDateTimeInUTCTimeZone('2023-04-27 10:00:00+00:00'), ]; } else if (isMysql(context)) { expectedDateTimeWithoutTz = [ @@ -647,9 +656,9 @@ test.describe('External DB - DateTime column', async () => { getDateTimeInUTCTimeZone('2023-04-27 10:00:00+00:00'), ]; expectedDateTimeWithTz = [ - '2023-04-27 10:00:00+00:00', - '2023-04-27 04:30:00+00:00', - getDateTimeInUTCTimeZone('2023-04-27 10:00:00+00:00'), + getDateTimeInLocalTimeZone('2023-04-27 10:00:00+00:00'), + getDateTimeInLocalTimeZone('2023-04-27 10:00:00+00:00'), + getDateTimeInLocalTimeZone('2023-04-27 10:00:00+00:00'), ]; }